POST /api/v1/shipments/{id}/discard

*This endpoint will work only through swagger client not for Public API users.

This API endpoint is used to discard a specific shipment with the ID.

The request body for this endpoint should not contain any specific parameters, as the shipment ID is already specified in the URL.

Input parameters:
id

 id *required integer($int32) (path) Pass the ID of the shipment to discard.

This id here is the unique shipment for shipment in your Locate2u account. You can pass this id in the request  and is required in order to reject/discard the shipments offer. Shipments offer is basically a job/work-order/delivery-order dispatching system used to send out shipments as an offer to eligible/best suited drivers/team-members. Drivers/team-members upon receiving a shipment offer can accept or discard it from their mobile apps. The request is sent via an HTTP POST method to the specified URL.

Sample code

C#
Java
NodeJS
PHP
Python
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "https://api.locate2u.com/api/v1/shipments/155106/discard");
request.Headers.Add("Authorization", "Bearer yourBearerTokenHere");
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());
OkHttpClient client = new OkHttpClient().newBuilder()
  .build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
  .url("https://api.locate2u.com/api/v1/shipments/155106/discard")
  .method("POST", body)
  .addHeader("Authorization", "Bearer yourBearerTokenHere")
  .build();
Response response = client.newCall(request).execute();
var https = require('follow-redirects').https;
var fs = require('fs');


var options = {
  'method': 'POST',
  'hostname': 'api.locate2u.com',
  'path': '/api/v1/shipments/155106/discard',
  'headers': {
    'Authorization': 'Bearer yourBearerTokenHere'
  },
  'maxRedirects': 20
};


var req = https.request(options, function (res) {
  var chunks = [];


  res.on("data", function (chunk) {
    chunks.push(chunk);
  });


  res.on("end", function (chunk) {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });


  res.on("error", function (error) {
    console.error(error);
  });
});


req.end();
 'https://api.locate2u.com/api/v1/shipments/155106/discard',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_HTTPHEADER => array(
    'Authorization: Bearer yourBearerTokenHere'
  ),
));


$response = curl_exec($curl);


curl_close($curl);
echo $response;
import requests


url = "https://api.locate2u.com/api/v1/shipments/155106/discard"


payload = {}
headers = {
  'Authorization': 'Bearer yourBearerTokenHere'
}


response = requests.request("POST", url, headers=headers, data=payload)


print(response.text)

Response

Upon the successful execution, the API return : 200 OK code.

Code        Description 

200          Success

401          Unauthorized

403          Forbidden

200          Success

401          Unauthorized

403          Forbidden