All URIs are relative to https://api-eu.dhl.com/post/de/shipping/im/v1, except if the operation defines another base path.
Method | HTTP request | Description |
---|---|---|
authorization() | POST /user | Get authorization token. |
retrieveUserData() | GET /user/profile | Authenticate and retrieve authorized user's data for shop. |
authorization($grant_type, $username, $password, $client_id, $client_secret, $for_payment): \kruegge82\DPIM\Model\Authentication200Response
Get authorization token.
This request is the precondition for almost all other calls! The call provides you with the Bearer token which is then used for all other calls. Here is how: The client makes a POST request to the 'user' resource by adding the following parameters using the application/x-www-form-urlencoded format with a character encoding of UTF-8 in the HTTP request body: * grant_type REQUIRED. Must be set to "client_credentials". * client_id REQUIRED (aka client_id (api key) -- obtained in DHL Developer Portal) * client_secret REQUIRED (aka client_secret -- obtained in DHL Developer Portal) * username REQUIRED. * password REQUIRED. The internetmarke credentials (username, password) for production access will be provided during onboarding, along with additional information. For sandbox access, suitable default values exist. See the remainder of the documentation.
<?php
require_once(__DIR__ . '/vendor/autoload.php');
$apiInstance = new kruegge82\DPIM\Api\UserResourceApi(
// 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()
);
$grant_type = 'grant_type_example'; // string | OAuth2 standard content, must be set to 'client_credentials'
$username = 'username_example'; // string | Internetmarke user name (e.g. 'franz.klammer').
$password = 'password_example'; // string | Internetmarke password (e.g. 'abfahrt123#')
$client_id = 'client_id_example'; // string | API client_id obtained from developer portal (e.g. 'XjSnyVWgQp1ShIQ5HQ6Vq5PIYLN2jGNS')
$client_secret = 'client_secret_example'; // string | API client_secret obtained from developer portal (e.g. 'TICgJWGRysH7mA57')
$for_payment = false; // bool | Flag to indicate the authorization for payment use case.
try {
$result = $apiInstance->authorization($grant_type, $username, $password, $client_id, $client_secret, $for_payment);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling UserResourceApi->authorization: ', $e->getMessage(), PHP_EOL;
}
Name | Type | Description | Notes |
---|---|---|---|
grant_type | string | OAuth2 standard content, must be set to 'client_credentials' | |
username | string | Internetmarke user name (e.g. 'franz.klammer'). | |
password | string | Internetmarke password (e.g. 'abfahrt123#') | |
client_id | string | API client_id obtained from developer portal (e.g. 'XjSnyVWgQp1ShIQ5HQ6Vq5PIYLN2jGNS') | |
client_secret | string | API client_secret obtained from developer portal (e.g. 'TICgJWGRysH7mA57') | |
for_payment | bool | Flag to indicate the authorization for payment use case. | [optional] [default to false] |
\kruegge82\DPIM\Model\Authentication200Response
No authorization required
- Content-Type:
application/x-www-form-urlencoded
- Accept:
application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
retrieveUserData(): \kruegge82\DPIM\Model\RetrieveUserDataResponse
Authenticate and retrieve authorized user's data for shop.
The client retrieves certain settings about his user profile.
<?php
require_once(__DIR__ . '/vendor/autoload.php');
// Configure Bearer authorization: BearerAuth
$config = kruegge82\DPIM\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');
$apiInstance = new kruegge82\DPIM\Api\UserResourceApi(
// 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
);
try {
$result = $apiInstance->retrieveUserData();
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling UserResourceApi->retrieveUserData: ', $e->getMessage(), PHP_EOL;
}
This endpoint does not need any parameter.
\kruegge82\DPIM\Model\RetrieveUserDataResponse
- Content-Type: Not defined
- Accept:
application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]