| POST | /picup/createshipment |
|---|
"use strict";
export class LinkedWaypoint {
/** @param {{FromWaypointNumber?:number,ToWaypointNumber?:number,FromLatitude?:number,FromLongitude?:number,ToLatitude?:number,ToLongitude?:number}} [init] */
constructor(init) { Object.assign(this, init) }
/** @type {number} */
FromWaypointNumber;
/** @type {number} */
ToWaypointNumber;
/** @type {number} */
FromLatitude;
/** @type {number} */
FromLongitude;
/** @type {number} */
ToLatitude;
/** @type {number} */
ToLongitude;
}
export class WaypointQuoteInformation extends LinkedWaypoint {
/** @param {{Distance?:number,DistanceValue?:string,WaypointValid?:boolean,Message?:string,ErrorDetails?:string[],Price?:number,PriceValue?:string,PriceWithVAT?:number,PriceValueWithVAT?:string,FromWaypointNumber?:number,ToWaypointNumber?:number,FromLatitude?:number,FromLongitude?:number,ToLatitude?:number,ToLongitude?:number}} [init] */
constructor(init) { super(init); Object.assign(this, init) }
/**
* @type {number}
* @description Distance between waypoints as a number */
Distance;
/**
* @type {string}
* @description String formatted distance */
DistanceValue;
/** @type {boolean} */
WaypointValid;
/** @type {string} */
Message;
/** @type {string[]} */
ErrorDetails;
/**
* @type {number}
* @description Caculated price between waypoints excluding vat */
Price;
/**
* @type {string}
* @description Price excluding vat formatted as a string rand value */
PriceValue;
/**
* @type {number}
* @description The price between waypoints including vat */
PriceWithVAT;
/**
* @type {string}
* @description The price including vat formatted as a rand value string */
PriceValueWithVAT;
}
export class WaypointValidationInformation {
/** @param {{WaypointNumber?:number,IsValid?:boolean,ErrorMessages?:string[]}} [init] */
constructor(init) { Object.assign(this, init) }
/** @type {number} */
WaypointNumber;
/** @type {boolean} */
IsValid;
/** @type {string[]} */
ErrorMessages;
}
export class PicUpCreateShipmentResponse {
/** @param {{is_success?:boolean,courier_reference?:string,error?:string,Waypoints?:WaypointQuoteInformation[],WaypointValidations?:WaypointValidationInformation[],Waybill?:string}} [init] */
constructor(init) { Object.assign(this, init) }
/** @type {boolean} */
is_success;
/** @type {string} */
courier_reference;
/** @type {string} */
error;
/**
* @type {WaypointQuoteInformation[]}
* @description List of order information for pricing etc between each waypoint */
Waypoints;
/**
* @type {WaypointValidationInformation[]}
* @description List with validation information for each waypoint */
WaypointValidations;
/**
* @type {string}
* @description The 1Fetch Waybill reference for the shipment */
Waybill;
}
export class BucketDetails {
/** @param {{delivery_date?:string}} [init] */
constructor(init) { Object.assign(this, init) }
/** @type {string} */
delivery_date;
}
export class CourierRequest {
/** @param {{bucket_details?:BucketDetails,shipments?:Shipment[]}} [init] */
constructor(init) { Object.assign(this, init) }
/** @type {BucketDetails} */
bucket_details;
/** @type {Shipment[]} */
shipments;
}
export class PicUpCreateShipmentRequest {
/** @param {{ApiKey?:string,courier_request?:CourierRequest}} [init] */
constructor(init) { Object.assign(this, init) }
/** @type {string} */
ApiKey;
/** @type {CourierRequest} */
courier_request;
}
export class Address {
/** @param {{address_line_1?:string,address_line_2?:string,address_line_3?:string,address_line_4?:string,city?:string,formatted_address?:string,latitude?:number,longitude?:number,postal_code?:string,suburb?:string,unit?:string,building?:string}} [init] */
constructor(init) { Object.assign(this, init) }
/** @type {string} */
address_line_1;
/** @type {string} */
address_line_2;
/** @type {string} */
address_line_3;
/** @type {string} */
address_line_4;
/** @type {string} */
city;
/** @type {string} */
formatted_address;
/** @type {number} */
latitude;
/** @type {number} */
longitude;
/** @type {string} */
postal_code;
/** @type {string} */
suburb;
/** @type {string} */
unit;
/** @type {string} */
building;
}
export class Contact {
/** @param {{customer_name?:string,customer_phone?:string,email_address?:string,special_instructions?:string}} [init] */
constructor(init) { Object.assign(this, init) }
/** @type {string} */
customer_name;
/** @type {string} */
customer_phone;
/** @type {string} */
email_address;
/** @type {string} */
special_instructions;
}
export class Sender {
/** @param {{address?:Address,contact?:Contact}} [init] */
constructor(init) { Object.assign(this, init) }
/** @type {Address} */
address;
/** @type {Contact} */
contact;
}
export class Receiver {
/** @param {{parcels?:Parcel[],address?:Address,contact?:Contact}} [init] */
constructor(init) { Object.assign(this, init) }
/** @type {Parcel[]} */
parcels;
/** @type {Address} */
address;
/** @type {Contact} */
contact;
}
export class Shipment {
/** @param {{waybill_number?:string,business_reference?:string,service_type?:string,sender?:Sender,receiver?:Receiver}} [init] */
constructor(init) { Object.assign(this, init) }
/** @type {string} */
waybill_number;
/** @type {string} */
business_reference;
/** @type {string} */
service_type;
/** @type {Sender} */
sender;
/** @type {Receiver} */
receiver;
}
export class Parcel {
/** @param {{parcel_waybill?:string,parcel_reference?:string,tracking_number?:string,length_mm?:number,width_mm?:number,height_mm?:number,weight_kg?:number}} [init] */
constructor(init) { Object.assign(this, init) }
/** @type {string} */
parcel_waybill;
/** @type {string} */
parcel_reference;
/** @type {string} */
tracking_number;
/** @type {number} */
length_mm;
/** @type {number} */
width_mm;
/** @type {number} */
height_mm;
/** @type {number} */
weight_kg;
}
JavaScript PicUpCreateShipmentRequest DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .jsv suffix or ?format=jsv
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /picup/createshipment HTTP/1.1
Host: api.1fetch.co.za
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length
{
ApiKey: String,
courier_request:
{
bucket_details:
{
delivery_date: 0001-01-01T00:00:00.0000000+00:00
},
shipments:
[
{
waybill_number: String,
business_reference: String,
service_type: String,
sender:
{
address:
{
address_line_1: String,
address_line_2: String,
address_line_3: String,
address_line_4: String,
city: String,
formatted_address: String,
latitude: 0,
longitude: 0,
postal_code: String,
suburb: String,
unit: String,
building: String
},
contact:
{
customer_name: String,
customer_phone: String,
email_address: String,
special_instructions: String
}
},
receiver:
{
parcels:
[
{
parcel_waybill: String,
parcel_reference: String,
tracking_number: String,
length_mm: 0,
width_mm: 0,
height_mm: 0,
weight_kg: 0
}
],
address:
{
address_line_1: String,
address_line_2: String,
address_line_3: String,
address_line_4: String,
city: String,
formatted_address: String,
latitude: 0,
longitude: 0,
postal_code: String,
suburb: String,
unit: String,
building: String
},
contact:
{
customer_name: String,
customer_phone: String,
email_address: String,
special_instructions: String
}
}
}
]
}
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length
{
is_success: False,
courier_reference: String,
error: String,
Waypoints:
[
{
}
],
WaypointValidations:
[
{
}
],
Waybill: String
}