Shipment API
API change historyREST JSON interface that exposes methods related to:
- Submitting a shipment to the notime platfom
- Checking a shipment's status
- Cancelling a shipment
- Updating shipment parameters after submission
Update Shipment
This method allows to update the parameters of a shipment, after the shipment has been submitted to the platform.
In particular it is possible to change the delivery times or the dropoff locations.
This method is also to be used in order to submit parcel information after the shipment has already been processed: For example this method might be called after picking of the products is completed and the number of parcels, barcodes and parcel sizes is now known.
Whether the shipment time windows or the dropoff location can still be changed depends on the status of the shipment. E.g. shortly before dropoff, only address changes few hundred meters from the original dropoff are allowed.
Dropoff notes can be added at any time and will be transmitted in real-time to the courier.
Shipments must be sent to the platform via the method Submit Shipment.
On successfully submitting a shipment to our platform the system returns a unique identifier for the shipment (shipment GUID). When updating a shipment , use this ID as the first parameter of the call.
Request
Request URL
Request headers
-
(optional)stringMedia type of the body sent to the API.
Request body
The root object is Shipment.
:Name | Type | Mandatory | Default | Note |
---|---|---|---|---|
ShipmentGuid | Guid | Yes | Guid identifying your shipment. | |
Action | Int | Yes | Update action to be performed on shipment. | |
Parcels | Array of Parcel objects | Yes, if action is UpdateParcels (11) | The parcels, barcodes and sizes that make up this shipment. | |
Location | POI object | Yes, if action is ChangeService (8) | It's overritten in NewLocationDropoff (1) action if Param is provided. | |
Param | Object | Yes, if action is other than UpdateParcels (11) |
Expected value depends on the action:
|
|
CallerId | Guid | Guid of the account. |
Value | Description |
---|---|
1 | Change dropoff location |
4 | Delay pickup |
5 | Replace shipment parcels |
6 | Add pickup note |
7 | Add dropoff note |
8 | Change service |
9 | Replace pickup note |
10 | Replace dropoff note |
11 | Update or add shipment parcels |
Name | Type | Mandatory | Default | Note |
---|---|---|---|---|
Reference | String |
If this is provided we try to find the corresponding item in the database. If found the rest of the POI object can be empty (so use only reference to specify POI object). If, together with a valid reference, the fields Name, ContactName, Note, Phone are provided, they will be replaced in the corresponding database entry. If a new reference is entered, a new POI is created in the database. The reference has to be unique within a GroupGuid. |
||
Name | String | StreetAddress | The name of the organisation "IBM Germany" that is located at this POI. | |
ContactName | String | The name of the person (resident) that is located at this POI, or the name of the contact person in case Name of organisation is specified | ||
StreetAddress | String | Yes, if no valid Reference | ||
PostCode | String | Yes, if no valid Reference | ||
City | String | Yes, if no valid Reference | ||
CountryCode | String | Yes, if no valid Reference | Country code e.g. "CH", "DE", "FR", "AT" | |
Phone | String | Main phone number. In the case of a dropoff POI, this should be a mobile phone number, as we use this one to send out the FolloMe SMS | ||
Phone2 | String | Additional phone number. This number will be given to the courier and operation manager in case the POI's contact is not reachable otherwise | ||
Phone3 | String | Additional phone number. This number will be given to the courier and operation manager in case the POI's contact is not reachable otherwise | ||
ContactEmailAddress | String | Email address under which the recipient can be contacted. In the case of a dropoff POI we use this email for our FollowMe emails. | ||
Note | String | Freetext message that assist the courier in finding the location. E.g. "Entrance is at the back" | ||
Labels | Array of String | Labels are used to describe the requirements that go with a certain shipment and the feature a deliverer offers. A typical requirement lable could mean: "Must be transported under 10C". "Must be transported flat". Labels are identified by their name. If this is provided we try to find it in the database otherwise it logs an error and the shipment is rejected. |
Name | Type | Mandatory | Default | Note |
---|---|---|---|---|
ParcelNumber | String | Custom identifier of a parcel | ||
Barcode | String | We support all commonly used barcode types. If no barcode is provided we will generate a unique QR code for this parcel. Barcodes and labels can be downloaded manually from the notime service management website or via the API method Get Labels | ||
Size | String | Optional information about the size of the parcel. E.g. "XS", "S" etc. For more information please contact support. In case all the dimensions of the parcel are provided the size gets calculated automatically. | ||
Weight | Double | Optional information about the weight of the parcel in kg. | ||
Length | Double | Optional information about the length of the parcel in cm. | ||
Width | Double | Optional information about the width of the parcel in cm. | ||
Height | Double | Optional information about the height of the parcel in cm. | ||
Type | int | Optional ParcelType. | ||
Name | String | Optional name of product inside a parcel. | ||
ImageUrl | String | Optional image url of product. This picture will be passed on to the courier and is visible to the operation manager. | ||
Notes | String | Optional notes. Maximum length is 256 symbols. | ||
ProductBarcodes | Array of String | Optional barcodes of original product. | ||
RequiredBarcodeTypes | Array of Product Barcode Type | Optional list of product barcode types. | ||
RequiredPowerAdapterIds | Array of Ints | Optional list of power adapters to add as part of the request. | ||
StorageReference | String | Optional product storage location. | ||
ContainerScanRequired | Boolean | False | Indicates whether the container should also be scanned. |
Name | Type | Mandatory | Default | Note |
---|---|---|---|---|
ServiceId | Guid | The identifier of the selected service object. The list of services can be received by calling Get Services method. | ||
Date | UTC Date string (YYYY-MM-DD) | Current Date (UTC) | Date of a given service. | |
EndUser | EndUser | Contact information of the person who will pick up the shipment from Pickup Point. This information should be provided only in the case service of the appropriate type is used during submission. |
Name | Type | Mandatory | Default | Note |
---|---|---|---|---|
FullName | String | Yes | Full name of the recipient. | |
Phone | String | Yes | Main phone number which is used to send out the FolloMe SMS. | |
Phone2 | String | Additional phone number. This number will be given to the operation manager in case the recipient is not reachable. | ||
Phone3 | String | Additional phone number. This number will be given to the operation manager in case the recipient is not reachable. | ||
String | Yes | Email address under which the recipient can be contacted. This email is used for our FollowMe emails. |
Code | Description |
---|---|
1 | Undefined Parcel Type |
2 | Temperature device |
3 | Regular Post Parcel |
4 | Shopping Bag |
5 | Original Product |
6 | Cooked Food |
7 | Open Container (used for shrinking) |
8 | Closed Container (used for shrinking) |
9 | Thermo box |
10 | Thermo bag |
11 | Hotgood ("Valuable, Expensive Product") |
12 | Power Adapter |
Code | Description |
---|---|
1 | Serial Number |
2 | IMEI |
{
"ShipmentGuid": "534efae5-8425-4b4b-85f4-c162470d8952",
"Action": "1",
"Param": {
"Name": "Bar",
"Phone": "+41987654321",
"City": "Zürich",
"CountryCode": "CH",
"Postcode": "8004",
"Streetaddress": "Badenerstrasse 97"
}
}
{
"ShipmentGuid": "534efae5-8425-4b4b-85f4-c162470d8952",
"Action": "4",
"Param": 10
}
{
"ShipmentGuid": "534efae5-8425-4b4b-85f4-c162470d8952",
"Action": "5",
"Param": [
{
"ParcelNumber": "01",
"Barcode": "9874561987319879431",
"Size": "S",
"Weight": 0.5
}
]
}
{
"ShipmentGuid": "534efae5-8425-4b4b-85f4-c162470d8952",
"Action": "6",
"Param": "Additional pickup note for shipment"
}
{
"ShipmentGuid": "AA465025-0795-4938-8C1E-6FFC0ECD6EC6",
"Action": 8,
"Param": {
"ServiceId": "3492052A-8FBB-43EF-ABD0-184F7D144BE3",
"Date": "2017-05-09"
},
"Location": {
"City": "Zürich",
"CountryCode": "CH",
"Postcode": "8005",
"Streetaddress": "Giessereistrasse 18"
}
}
{
"ShipmentGuid": "534efae5-8425-4b4b-85f4-c162470d8952",
"Action": "9",
"Param": "New pickup note for shipment"
}
{
"ShipmentGuid": "534efae5-8425-4b4b-85f4-c162470d8952",
"Action": "11",
"Parcels": [
{
"ParcelNumber": "01",
"Barcode": "9874561987319879431",
"Size": "S",
"Weight": 0.5
}
]
}
Responses
200 OK
Returned if the shipment has been changed successfully. The ResultCode is always set to "0" in this case.
Representations
{
"ResultCode": 0,
"ErrorString": null
}
400 Bad Request
Returned in cases where the submitted request body doesn't fit the validation rules or the business rules.
Code | Description |
---|---|
5 | Invalid timeslot given. |
6 | The given location can't be geocoded. |
7 | This location change is not, or no longer permitted. |
8 | This change of time window is no longer allowed. |
9 | The given delay parameter is outside of the allowed range. |
10 | The given new location is identical with the old one. (within 20 meter radius) |
11 | The given date time format is wrong |
16 | Invalid service given. |
18 | This service change is not, or no longer permitted. |
99 | General Error. Check the field ErrorString for more information |
Representations
{
"ResultCode": 99,
"ErrorString": "ShipmentGuid or ShipmentReference is not provided",
"Success": false
}
404 Not Found
Returned in case if specified shipment is not found.
Code samples
@ECHO OFF
curl -v -X POST "https://v1.notimeapi.com/api/shipment/update"
-H "Content-Type: Action 1"
-H "Ocp-Apim-Subscription-Key: {subscription key}"
--data-ascii "{body}"
using System;
using System.Net.Http.Headers;
using System.Text;
using System.Net.Http;
using System.Web;
namespace CSHttpClientSample
{
static class Program
{
static void Main()
{
MakeRequest();
Console.WriteLine("Hit ENTER to exit...");
Console.ReadLine();
}
static async void MakeRequest()
{
var client = new HttpClient();
var queryString = HttpUtility.ParseQueryString(string.Empty);
// Request headers
client.DefaultRequestHeaders.Add("Ocp-Apim-Subscription-Key", "{subscription key}");
var uri = "https://v1.notimeapi.com/api/shipment/update?" + queryString;
HttpResponseMessage response;
// Request body
byte[] byteData = Encoding.UTF8.GetBytes("{body}");
using (var content = new ByteArrayContent(byteData))
{
content.Headers.ContentType = new MediaTypeHeaderValue("< your content type, i.e. application/json >");
response = await client.PostAsync(uri, content);
}
}
}
}
// // This sample uses the Apache HTTP client from HTTP Components (http://hc.apache.org/httpcomponents-client-ga/)
import java.net.URI;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.utils.URIBuilder;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
public class JavaSample
{
public static void main(String[] args)
{
HttpClient httpclient = HttpClients.createDefault();
try
{
URIBuilder builder = new URIBuilder("https://v1.notimeapi.com/api/shipment/update");
URI uri = builder.build();
HttpPost request = new HttpPost(uri);
request.setHeader("Content-Type", "Action 1");
request.setHeader("Ocp-Apim-Subscription-Key", "{subscription key}");
// Request body
StringEntity reqEntity = new StringEntity("{body}");
request.setEntity(reqEntity);
HttpResponse response = httpclient.execute(request);
HttpEntity entity = response.getEntity();
if (entity != null)
{
System.out.println(EntityUtils.toString(entity));
}
}
catch (Exception e)
{
System.out.println(e.getMessage());
}
}
}
<!DOCTYPE html>
<html>
<head>
<title>JSSample</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
</head>
<body>
<script type="text/javascript">
$(function() {
var params = {
// Request parameters
};
$.ajax({
url: "https://v1.notimeapi.com/api/shipment/update?" + $.param(params),
beforeSend: function(xhrObj){
// Request headers
xhrObj.setRequestHeader("Content-Type","Action 1");
xhrObj.setRequestHeader("Ocp-Apim-Subscription-Key","{subscription key}");
},
type: "POST",
// Request body
data: "{body}",
})
.done(function(data) {
alert("success");
})
.fail(function() {
alert("error");
});
});
</script>
</body>
</html>
#import <Foundation/Foundation.h>
int main(int argc, const char * argv[])
{
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
NSString* path = @"https://v1.notimeapi.com/api/shipment/update";
NSArray* array = @[
// Request parameters
@"entities=true",
];
NSString* string = [array componentsJoinedByString:@"&"];
path = [path stringByAppendingFormat:@"?%@", string];
NSLog(@"%@", path);
NSMutableURLRequest* _request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:path]];
[_request setHTTPMethod:@"POST"];
// Request headers
[_request setValue:@"Action 1" forHTTPHeaderField:@"Content-Type"];
[_request setValue:@"{subscription key}" forHTTPHeaderField:@"Ocp-Apim-Subscription-Key"];
// Request body
[_request setHTTPBody:[@"{body}" dataUsingEncoding:NSUTF8StringEncoding]];
NSURLResponse *response = nil;
NSError *error = nil;
NSData* _connectionData = [NSURLConnection sendSynchronousRequest:_request returningResponse:&response error:&error];
if (nil != error)
{
NSLog(@"Error: %@", error);
}
else
{
NSError* error = nil;
NSMutableDictionary* json = nil;
NSString* dataString = [[NSString alloc] initWithData:_connectionData encoding:NSUTF8StringEncoding];
NSLog(@"%@", dataString);
if (nil != _connectionData)
{
json = [NSJSONSerialization JSONObjectWithData:_connectionData options:NSJSONReadingMutableContainers error:&error];
}
if (error || !json)
{
NSLog(@"Could not parse loaded json with error:%@", error);
}
NSLog(@"%@", json);
_connectionData = nil;
}
[pool drain];
return 0;
}
<?php
// This sample uses the Apache HTTP client from HTTP Components (http://hc.apache.org/httpcomponents-client-ga/)
require_once 'HTTP/Request2.php';
$request = new Http_Request2('https://v1.notimeapi.com/api/shipment/update');
$url = $request->getUrl();
$headers = array(
// Request headers
'Content-Type' => 'Action 1',
'Ocp-Apim-Subscription-Key' => '{subscription key}',
);
$request->setHeader($headers);
$parameters = array(
// Request parameters
);
$url->setQueryVariables($parameters);
$request->setMethod(HTTP_Request2::METHOD_POST);
// Request body
$request->setBody("{body}");
try
{
$response = $request->send();
echo $response->getBody();
}
catch (HttpException $ex)
{
echo $ex;
}
?>
########### Python 2.7 #############
import httplib, urllib, base64
headers = {
# Request headers
'Content-Type': 'Action 1',
'Ocp-Apim-Subscription-Key': '{subscription key}',
}
params = urllib.urlencode({
})
try:
conn = httplib.HTTPSConnection('v1.notimeapi.com')
conn.request("POST", "/api/shipment/update?%s" % params, "{body}", headers)
response = conn.getresponse()
data = response.read()
print(data)
conn.close()
except Exception as e:
print("[Errno {0}] {1}".format(e.errno, e.strerror))
####################################
########### Python 3.2 #############
import http.client, urllib.request, urllib.parse, urllib.error, base64
headers = {
# Request headers
'Content-Type': 'Action 1',
'Ocp-Apim-Subscription-Key': '{subscription key}',
}
params = urllib.parse.urlencode({
})
try:
conn = http.client.HTTPSConnection('v1.notimeapi.com')
conn.request("POST", "/api/shipment/update?%s" % params, "{body}", headers)
response = conn.getresponse()
data = response.read()
print(data)
conn.close()
except Exception as e:
print("[Errno {0}] {1}".format(e.errno, e.strerror))
####################################
require 'net/http'
uri = URI('https://v1.notimeapi.com/api/shipment/update')
request = Net::HTTP::Post.new(uri.request_uri)
# Request headers
request['Content-Type'] = 'Action 1'
# Request headers
request['Ocp-Apim-Subscription-Key'] = '{subscription key}'
# Request body
request.body = "{body}"
response = Net::HTTP.start(uri.host, uri.port, :use_ssl => uri.scheme == 'https') do |http|
http.request(request)
end
puts response.body