Bulk cancel publications

Active freight pub­li­ca­tions can be can­celed in bulk. It removes the freights from the list of freights vis­i­ble to car­ri­ers. Ongo­ing nego­ti­a­tions with car­ri­ers are being reject­ed.
Can­cel­la­tion is pos­si­ble for freight pub­lished by any employ­ee in your com­pa­ny. It pos­si­ble to can­cel max 10 freights in one request.

POST
/ext/freights-api/v1/cancelPublication

Request Authorization

Every request MUST include a valid access token obtained dur­ing the user autho­riza­tion process, pro­vid­ed using the Bear­er token scheme in the Autho­riza­tion head­er.

Successful Response
Request Header
POST /ext/freights-api/v1/cancelPublication HTTP/1.1 
Host: api.platform.trans.eu 
Content-Type: application/json
Accept: application/json
Authorization: Bearer {access_token) 
Api-key: {unique_app_api-key}
Request Parameters
AttributeTypeExam­pleManda­to­ryDescrip­tion
freight-idArray of Int856796, 234578YesFreight iden­ti­fi­ca­tion num­bers to can­cel pub­li­ca­tion
Example Request Body
[856796, 234578]
Response Fields
AttributeTypeExam­pleDescrip­tion
freights_publicationsArray of ObjectsList of accept­ed freights to can­cel
freights.idInt856796Freight iden­ti­fi­ca­tion num­ber
Response Body
{
    "freights_publications": [
        {
            "id": 856796
        },
        {
            "id": 234578
        }
    ]
}

Client errors (code 4xx)

HTTP 4xx sta­tus codes indi­cate client errors, mean­ing that the request could not be processed due to an issue on the client side. Below is a list of request-spe­cif­ic errors.

Example error 1

No freights id in request or freights does not exists

{
    "detail": "Can't find any publication to cancel",
    "status": 404,
    "title": "Not Found"
}
Example error 2

Incor­rect freight pub­li­ca­tion sta­tus

{
    "detail": "Cancellation is not possible. Status of publication 'finished' is forbidden",
    "status": 422,
    "title": "Unprocessable Entity",
    "type": "http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html"
}
Example error 3

Too many freight ids in one request

{
    "error": "Bulk limit reached. You can only cancel '10' per request"
}