The Dangerous Goods API provides the ability to determine if certain materials, such as dangerous goods or hazardous materials, can be shipped with UPS. The API's two endpoints - Chemical Reference Data and Acceptance Audit Precheck, help perform pre-checks before shipping any dangerous goods. # Reference - <a href="proxy.php?url=https%3A%2F%2Fgithub.com%2F%3Ca+href%3D"https://developer.ups.com/api/reference/dangerousgoods/business-rules%5C" rel="nofollow">https://developer.ups.com/api/reference/dangerousgoods/business-rules\" target="_blank" rel="noopener">Business Rules - <a href="proxy.php?url=https%3A%2F%2Fgithub.com%2F%3Ca+href%3D"https://developer.ups.com/api/reference/dangerousgoods/appendix%5C" rel="nofollow">https://developer.ups.com/api/reference/dangerousgoods/appendix\" target="_blank" rel="noopener">Appendix - <a href="proxy.php?url=https%3A%2F%2Fgithub.com%2F%3Ca+href%3D"https://developer.ups.com/api/reference/dangerousgoods/errors%5C" rel="nofollow">https://developer.ups.com/api/reference/dangerousgoods/errors\" target="_blank" rel="noopener">Errors - <a href="proxy.php?url=https%3A%2F%2Fgithub.com%2F%3Ca+href%3D"https://developer.ups.com/api/reference/dangerousgoods/faq%5C" rel="nofollow">https://developer.ups.com/api/reference/dangerousgoods/faq\" target="_blank" rel="noopener">FAQ
Try out UPS APIs with example requests using Postman. Explore API documentation and sample applications through GitHub.
<a href="proxy.php?url=https%3A%2F%2Fgithub.com%2F%3Ca+href%3D"https://god.gw.postman.com/run-collection/29542085-bb17460a-ed1a-4267-8c58-a8cc50a48f7a?action=collection%2Ffork&source=rip_markdown&collection-url=entityId%3D29542085-bb17460a-ed1a-4267-8c58-a8cc50a48f7a%26entityType%3Dcollection%26workspaceId%3D7e7595f0-4829-4f9a-aee1-75c126b9d417%5C" rel="nofollow">https://god.gw.postman.com/run-collection/29542085-bb17460a-ed1a-4267-8c58-a8cc50a48f7a?action=collection%2Ffork&source=rip_markdown&collection-url=entityId%3D29542085-bb17460a-ed1a-4267-8c58-a8cc50a48f7a%26entityType%3Dcollection%26workspaceId%3D7e7595f0-4829-4f9a-aee1-75c126b9d417\" target="_blank" rel="noopener noreferrer"> <img src="proxy.php?url=https%3A%2F%2Fgithub.com%2F%3Ca+href%3D"https://run.pstmn.io/button.svg%5C" rel="nofollow">https://run.pstmn.io/button.svg\" alt="Run In Postman" style="width: 128px; height: 32px;"> <a href="proxy.php?url=https%3A%2F%2Fgithub.com%2F%3Ca+href%3D"https://github.com/UPS-API%5C">https://github.com/UPS-API\" target="_blank" rel="noopener noreferrer"> <img src="proxy.php?url=https%3A%2F%2Fgithub.com%2F%3Ca+href%3D"https://www.ups.com/assets/resources/webcontent/images/gitHubButton.svg%5C" rel="nofollow">https://www.ups.com/assets/resources/webcontent/images/gitHubButton.svg\" alt="Open in GitHub " style="width: 128px; height: 32px;">This PHP package is automatically generated by the Swagger Codegen project:
- API version:
- Package version: 1.0.9
- Build package: io.swagger.codegen.v3.generators.php.PhpClientCodegen
PHP 5.5 and later
To install the bindings via Composer, add the following to composer.json:
{
"repositories": [
{
"type": "git",
"url": "https://github.com/abantecart/ups-dangerous-goods.git"
}
],
"require": {
"abantecart/ups-dangerous-goods": "*@dev"
}
}
Then run composer install
Download the files and include autoload.php:
require_once('/path/to/DangerousGoods/vendor/autoload.php');To run the unit tests:
composer install
./vendor/bin/phpunit
Please follow the installation procedure and then run the following:
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Configure OAuth2 access token for authorization: OAuth2
$config = UPS\DangerousGoods\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
$apiInstance = new UPS\DangerousGoods\Request\DangerousGoodsApi(
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
// This is optional, `GuzzleHttp\Client` will be used as default.
new GuzzleHttp\Client(),
$config
);
$body = new \UPS\DangerousGoods\DangerousGoods\DANGEROUSGOODSUTILITYAPCRequestWrapper(); // \UPS\DangerousGoods\DangerousGoods\DANGEROUSGOODSUTILITYAPCRequestWrapper | Generate sample code for popular API requests by selecting an example below. To view a full sample request and response, first click \"Authorize\" and enter your application credentials, then populate the required parameters above and click \"Try it out\".
$trans_id = "trans_id_example"; // string | An identifier unique to the request. Length 32
$transaction_src = "testing"; // string | An identifier of the client/source application that is making the request.Length 512
$version = "version_example"; // string | API version Valid values: - v2
try {
$result = $apiInstance->acceptanceAuditPreCheck($body, $trans_id, $transaction_src, $version);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling DangerousGoodsApi->acceptanceAuditPreCheck: ', $e->getMessage(), PHP_EOL;
}
// Configure OAuth2 access token for authorization: OAuth2
$config = UPS\DangerousGoods\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
$apiInstance = new UPS\DangerousGoods\Request\DangerousGoodsApi(
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
// This is optional, `GuzzleHttp\Client` will be used as default.
new GuzzleHttp\Client(),
$config
);
$body = new \UPS\DangerousGoods\DangerousGoods\DANGEROUSGOODSUTILITYRequestWrapper(); // \UPS\DangerousGoods\DangerousGoods\DANGEROUSGOODSUTILITYRequestWrapper | Generate sample code for popular API requests by selecting an example below. To view a full sample request and response, first click \"Authorize\" and enter your application credentials, then populate the required parameters above and click \"Try it out\".
$trans_id = "trans_id_example"; // string | An identifier unique to the request. Length 32
$transaction_src = "testing"; // string | An identifier of the client/source application that is making the request.Length 512
$version = "version_example"; // string | Version of the API. Valid values: - v2409
try {
$result = $apiInstance->chemicalReferenceData($body, $trans_id, $transaction_src, $version);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling DangerousGoodsApi->chemicalReferenceData: ', $e->getMessage(), PHP_EOL;
}
// Configure OAuth2 access token for authorization: OAuth2
$config = UPS\DangerousGoods\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
$apiInstance = new UPS\DangerousGoods\Request\DangerousGoodsApi(
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
// This is optional, `GuzzleHttp\Client` will be used as default.
new GuzzleHttp\Client(),
$config
);
$body = new \UPS\DangerousGoods\DangerousGoods\DANGEROUSGOODSUTILITYAPCRequestWrapper(); // \UPS\DangerousGoods\DangerousGoods\DANGEROUSGOODSUTILITYAPCRequestWrapper | Generate sample code for popular API requests by selecting an example below. To view a full sample request and response, first click \"Authorize\" and enter your application credentials, then populate the required parameters above and click \"Try it out\".
$trans_id = "trans_id_example"; // string | An identifier unique to the request. Length 32
$transaction_src = "testing"; // string | An identifier of the client/source application that is making the request.Length 512
$deprecated_version = "deprecated_version_example"; // string | API version Valid values: - v1
try {
$result = $apiInstance->deprecatedAcceptanceAuditPreCheck($body, $trans_id, $transaction_src, $deprecated_version);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling DangerousGoodsApi->deprecatedAcceptanceAuditPreCheck: ', $e->getMessage(), PHP_EOL;
}
// Configure OAuth2 access token for authorization: OAuth2
$config = UPS\DangerousGoods\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
$apiInstance = new UPS\DangerousGoods\Request\DangerousGoodsApi(
// If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
// This is optional, `GuzzleHttp\Client` will be used as default.
new GuzzleHttp\Client(),
$config
);
$body = new \UPS\DangerousGoods\DangerousGoods\DANGEROUSGOODSUTILITYRequestWrapper(); // \UPS\DangerousGoods\DangerousGoods\DANGEROUSGOODSUTILITYRequestWrapper | Generate sample code for popular API requests by selecting an example below. To view a full sample request and response, first click \"Authorize\" and enter your application credentials, then populate the required parameters above and click \"Try it out\".
$trans_id = "trans_id_example"; // string | An identifier unique to the request. Length 32
$transaction_src = "testing"; // string | An identifier of the client/source application that is making the request.Length 512
$deprecated_version = "deprecated_version_example"; // string | Version of the API. Valid values: - v1 - v1801.
try {
$result = $apiInstance->deprecatedChemicalReferenceData($body, $trans_id, $transaction_src, $deprecated_version);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling DangerousGoodsApi->deprecatedChemicalReferenceData: ', $e->getMessage(), PHP_EOL;
}
?>All URIs are relative to https://wwwcie.ups.com/api
| Class | Method | HTTP request | Description |
|---|---|---|---|
| DangerousGoodsApi | acceptanceAuditPreCheck | POST /dangerousgoods/{version}/acceptanceauditprecheck | Acceptance Audit Pre-check |
| DangerousGoodsApi | chemicalReferenceData | POST /dangerousgoods/{version}/chemicalreferencedata | Chemical Reference Data |
| DangerousGoodsApi | deprecatedAcceptanceAuditPreCheck | POST /dangerousgoods/{deprecatedVersion}/acceptanceauditprecheck | Acceptance Audit Pre-check |
| DangerousGoodsApi | deprecatedChemicalReferenceData | POST /dangerousgoods/{deprecatedVersion}/chemicalreferencedata | Chemical Reference Data |
- AcceptanceAuditPreCheckRequest
- AcceptanceAuditPreCheckRequestRequest
- AcceptanceAuditPreCheckRequestShipment
- AcceptanceAuditPreCheckResponse
- AcceptanceAuditPreCheckResponsePackageResults
- AcceptanceAuditPreCheckResponseResponse
- AcceptanceAuditPreCheckResponseService
- AlertDetailElementLevelInformation
- ChemicalDataChemicalDetail
- ChemicalDataPackageQuantityLimitDetail
- ChemicalDataProperShippingNameDetail
- ChemicalReferenceDataRequest
- ChemicalReferenceDataRequestRequest
- ChemicalReferenceDataResponse
- ChemicalReferenceDataResponseChemicalData
- ChemicalReferenceDataResponseResponse
- CommonErrorResponse
- DANGEROUSGOODSUTILITYAPCRequestWrapper
- DANGEROUSGOODSUTILITYAPCResponseWrapper
- DANGEROUSGOODSUTILITYRequestWrapper
- DANGEROUSGOODSUTILITYResponseWrapper
- ElementLevelInformationElementIdentifier
- ErrorMessage
- ErrorResponse
- PackageChemicalRecord
- PackagePackageWeight
- PackageResultsChemicalRecordResults
- PackageWeightUnitOfMeasurement
- RequestTransactionReference
- ResponseAlert
- ResponseAlertDetail
- ResponseResponseStatus
- ResponseTransactionReference
- ShipmentPackage
- ShipmentService
- ShipmentShipFromAddress
- ShipmentShipToAddress
- Type: OAuth
- Flow: application
- Authorization URL:
- Scopes: