Shipment API

API change history

REST 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

5. 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.

Try it

Request URL

Request headers

string
Subscription key which provides access to this API. Found in your Profile.

Request body

Name Type Mandatory Note
ShipmentGuid Guid Yes Guid identifying a shipment. The shipment GUID received when initially submitting the shipment.
Action Int Yes
  • 1: Update Dropoff Location
  • 2: Update Dropoff Timeslot
  • 3: Update Pickup Timeslot
  • 4: Submit Expected Delay
  • 5: Submit Parcel and Barcode Information
  • 6: Submit a Pickup Note
  • 7: Submit a Dropoff Note
  • 8: Change Service
Param Object Additional Information to be provided depending on the action type.
  • In the case of Action 1 it is the new dropoff location of type POI.
  • In the case of Actions 2 and 3 it is the TimeWindow of the new dropoff or pickup timeslot.
  • In the case of Action 4 it is the delay in minutes.
  • In the case of Action 5 it is an Array of Parcel
  • In the case of Actions 6 and 7 it is the text of dropoff or pickup note.
  • In the case of Actions 8 it is new Service.
Location POI New dropoff location. It could be used in the following cases:
  • Action 1 instead of passing it in Param property.
  • Action 8 in case of changing service from PickupPoint type to HomeDelivery.


Name Type Mandatory Default Note
TimeWindowGuid Guid Yes The identifier (GUID) of the new dropoff or pickup timeslot. This GUID is received either via the Check Services method or from a list of hardcoded values.
Date UTC Date string (YYYY-MM-DD) No Today The date of new dropoff or pickup timeslot


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
Phone String Main phone number.
Phone2 String Additional phone number.
Phone3 String Additional phone number.
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"
ContactName String
ContactEmailAddress String
Note String
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 and error.


Name Type Mandatory Default Note
ParcelNumber String No 01 Custom identifier of a parcel
Barcode String Yes
Size String No "M" Optional information about the size of the parcel. E.g. "XS", "S" etc. For more information please contact support.
Weight Double No Optional information about the weight of the parcel in kg.


Name Type Mandatory Default Note
ServiceId Guid Yes The identifier (GUID) of the service. This GUID is received either via the Get Services method or from a list of hardcoded values.
Date UTC Date string (YYYY-MM-DD) Yes Date of delivery

{ 
"ShipmentGuid" : "534efae5-8425-4b4b-85f4-c162470d8952",
"Action": "2",
"Param": 
{
"TimeWindowGuid": "A59EDEC0-2280-429F-97AE-63AD0E55F762"
}
}
{ 
"ShipmentGuid" : "534efae5-8425-4b4b-85f4-c162470d8952",
"Action": "1",
"Param": 
{
"Name":"Bar",
"Phone":"+41987654321",
"City":"Z\u00fcrich",
"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": "New 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\u00fcrich",
      "CountryCode":"CH",
      "Postcode":"8005",
      "Streetaddress":"Giessereistrasse 18"
   }
}

Response 404

Returned in case if specified shipment is not found.

Response 400

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.

{"ResultCode":99,"Data":null,"ErrorString":"ShipmentGuid or ShipmentReference is not provided","Success":false}

Response 200

Returned if the shipment has been changed successfully. In some instances we provide additional information in the ResultCode

Code Description
1 The time window has been changed.
2 The location has been changed.
3 The location and time window has been changed. This happens in cases where the dropoff address is changed to a different region. In these cases we might have to adjust the time window slightely. Time windows will never be changed by more than 60 minutes
4 Parcel and barcode data have been updated.
17 The service has been changed.

Code samples

@ECHO OFF

curl -v -X POST "https://v1.notimeapi.com/api/shipment/update"
-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("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("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:@"{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
    '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
    '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
    '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['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