2Service Services API

<back to all web services

PostNewOrder

The following routes are available for this service:
POST/dealers/orderPlaces a new order with the specified items.
"use strict";
export class AuthenticatedRequest {
    /** @param {{SessionToken?:string}} [init] */
    constructor(init) { Object.assign(this, init) }
    /**
     * @type {string}
     * @description Session token received from successful authentication. */
    SessionToken;
}
export class NewOrderResult {
    /** @param {{OrderNumber?:string}} [init] */
    constructor(init) { Object.assign(this, init) }
    /**
     * @type {?string}
     * @description Number for the order that has been placed. */
    OrderNumber;
}
export class OperationResult {
    /** @param {{IsSuccessful?:boolean,ErrorMessage?:string}} [init] */
    constructor(init) { Object.assign(this, init) }
    /**
     * @type {boolean}
     * @description Specifies if the operation was successful. */
    IsSuccessful;
    /**
     * @type {?string}
     * @description States error message in case of unsuccessful operation. */
    ErrorMessage;
}
export class PartInfoResultImage {
    /** @param {{ImageNumber?:number,ImageUrl?:string}} [init] */
    constructor(init) { Object.assign(this, init) }
    /**
     * @type {number}
     * @description Image number */
    ImageNumber;
    /**
     * @type {?string}
     * @description Image URL */
    ImageUrl;
}
export class PartStockQuantity {
    /** @param {{LocationId?:number,LocationCode?:string,StockQuantity?:number}} [init] */
    constructor(init) { Object.assign(this, init) }
    /**
     * @type {number}
     * @description Location ID */
    LocationId;
    /**
     * @type {?string}
     * @description Location code */
    LocationCode;
    /**
     * @type {number}
     * @description Stock quantity in location */
    StockQuantity;
}
export class PartInfoResult {
    /** @param {{Id?:number,PartNumber?:string,Description?:string,Manufacturer?:string,CanBeOrdered?:boolean,StatusText?:string,AvailableStockQuantity?:number,AverageDeliveryInDays?:number,UnitPrice?:number,EanNumber?:string,Images?:PartInfoResultImage[],SecondaryArticleNumbers?:string[],ReplacementArticleNumbers?:string[],StockQuantities?:PartStockQuantity[]}} [init] */
    constructor(init) { Object.assign(this, init) }
    /**
     * @type {number}
     * @description Unique ID for the part. */
    Id;
    /**
     * @type {?string}
     * @description Part number. */
    PartNumber;
    /**
     * @type {?string}
     * @description Description of the part. */
    Description;
    /**
     * @type {?string}
     * @description Part manufacturer. */
    Manufacturer;
    /**
     * @type {boolean}
     * @description Determines if the part can be ordered. */
    CanBeOrdered;
    /**
     * @type {?string}
     * @description Textual representation of the status of the part. */
    StatusText;
    /**
     * @type {number}
     * @description Available stock to order. */
    AvailableStockQuantity;
    /**
     * @type {?number}
     * @description Average days needed for delivery. */
    AverageDeliveryInDays;
    /**
     * @type {?number}
     * @description Price of a single unit, excluding VAT. */
    UnitPrice;
    /**
     * @type {?string}
     * @description EAN number. */
    EanNumber;
    /**
     * @type {?PartInfoResultImage[]}
     * @description Images */
    Images;
    /**
     * @type {?string[]}
     * @description Secondary article numbers */
    SecondaryArticleNumbers;
    /**
     * @type {?string[]}
     * @description Replacement article numbers */
    ReplacementArticleNumbers;
    /**
     * @type {?PartStockQuantity[]}
     * @description Stock quantities */
    StockQuantities;
}
export class PartResults {
    /** @param {{TotalNumberOfParts?:number,HasMoreRecords?:boolean,Parts?:PartInfoResult[]}} [init] */
    constructor(init) { Object.assign(this, init) }
    /**
     * @type {number}
     * @description Total number of parts available. */
    TotalNumberOfParts;
    /**
     * @type {boolean}
     * @description Indication if there are more parts to retrieve. */
    HasMoreRecords;
    /**
     * @type {?PartInfoResult[]}
     * @description Part records. */
    Parts;
}
/** @typedef T {any} */
export class OperationResult_1 extends OperationResult {
    /** @param {{Result?:PartResults,IsSuccessful?:boolean,ErrorMessage?:string}} [init] */
    constructor(init) { super(init); Object.assign(this, init) }
    /**
     * @type {?PartResults}
     * @description Result value */
    Result;
}
export class NewOrderResponse extends OperationResult_1 {
    /** @param {{Result?:PartResults,IsSuccessful?:boolean,ErrorMessage?:string}} [init] */
    constructor(init) { super(init); Object.assign(this, init) }
}
export class NewOrderItem {
    /** @param {{PartId?:number,Quantity?:number,Reference?:string}} [init] */
    constructor(init) { Object.assign(this, init) }
    /**
     * @type {number}
     * @description Unique ID for the part. */
    PartId;
    /**
     * @type {number}
     * @description Quantity to order. */
    Quantity;
    /**
     * @type {?string}
     * @description Custom reference. */
    Reference;
}
export class NewOrderItemList extends Array {
    constructor(init) { super(init); Object.assign(this, init) }
}
export class NewOrderAddress {
    /** @param {{CompanyName?:string,FirstName?:string,LastName?:string,StreetName?:string,HouseNumber?:string,HouseNumberAddition?:string,PostalCode?:string,City?:string,CountryCode?:string,TelephoneNumber?:string}} [init] */
    constructor(init) { Object.assign(this, init) }
    /**
     * @type {?string}
     * @description Company name. */
    CompanyName;
    /**
     * @type {?string}
     * @description First name. */
    FirstName;
    /**
     * @type {?string}
     * @description Last name. */
    LastName;
    /**
     * @type {string}
     * @description Street name. */
    StreetName;
    /**
     * @type {string}
     * @description House number. */
    HouseNumber;
    /**
     * @type {?string}
     * @description House number addition. */
    HouseNumberAddition;
    /**
     * @type {string}
     * @description Postal code. */
    PostalCode;
    /**
     * @type {string}
     * @description City. */
    City;
    /**
     * @type {string}
     * @description Country code. */
    CountryCode;
    /**
     * @type {?string}
     * @description Telephone number. */
    TelephoneNumber;
}
export class PostNewOrder extends AuthenticatedRequest {
    /** @param {{Items?:NewOrderItemList,UseDropshipment?:boolean,DeliveryAddress?:NewOrderAddress,SessionToken?:string}} [init] */
    constructor(init) { super(init); Object.assign(this, init) }
    /**
     * @type {NewOrderItemList}
     * @description Items to order. */
    Items;
    /**
     * @type {?boolean}
     * @description Dropshipment indication. */
    UseDropshipment;
    /**
     * @type {?NewOrderAddress}
     * @description Delivery address. */
    DeliveryAddress;
}

JavaScript PostNewOrder DTOs

To override the Content-type in your clients, use the HTTP Accept Header, append the .json suffix or ?format=json

To embed the response in a jsonp callback, append ?callback=myCallback

HTTP + JSON

The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.

POST /dealers/order HTTP/1.1 
Host: services.acct.2service.nl 
Accept: application/json
Content-Type: application/json
Content-Length: length

{"Items":[{"PartId":0,"Quantity":0,"Reference":"String"}],"UseDropshipment":false,"DeliveryAddress":{"CompanyName":"String","FirstName":"String","LastName":"String","StreetName":"String","HouseNumber":"String","HouseNumberAddition":"String","PostalCode":"String","City":"String","CountryCode":"String","TelephoneNumber":"String"},"SessionToken":"String"}
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: length

{"Result":{"OrderNumber":"String"},"IsSuccessful":false,"ErrorMessage":"String"}