PUT api/v1/shipments/{shipmentId}/cost-lines/{costLineId}
Update Shipment Charge Line
This endpoint is used to update a specific charge line for a shipment.
Request
Method: PUT
URL: https://api.locate2u.com/api/v1/shipments/{shipmentId}/cost-lines/{costLineId}
Headers:
Content-Type: application/json
Input parameters:
shipmentId
shipmentId * integer($int32) (path). This id here is the unique shipment id of the shipment in your Locate2u account for which you want to update the cost-line.
costLineId
costLineId* integer($int32) (path). Unique id of the cost line for which you would like to make the update.
Request body:
The request body should be in raw format and should include the following parameters:
- description (string, optional): Description of the charge line.
- quantity (number, required): Quantity of the charge line.
- unitPriceExTax (number, required): Unit price of the charge line excluding tax.
Example body :
{
"description": "Fuel charge",
"quantity": 1,
"unitPriceExTax": 10
}
Sample code
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Put, "https://api.locate2u.com/api/v1/shipments/105333/cost-lines/1194848");
request.Headers.Add("Authorization", "Bearer yourBearerTokenHere");
var content = new StringContent("{\r\n \"description\": \"Update Fuel charge\",\r\n \"quantity\": 1,\r\n \"unitPriceExTax\": 50\r\n}", null, "application/json");
request.Content = content;
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\r\n \"description\": \"Update Fuel charge\",\r\n \"quantity\": 1,\r\n \"unitPriceExTax\": 50\r\n}");
Request request = new Request.Builder()
.url("https://api.locate2u.com/api/v1/shipments/105333/cost-lines/1194848")
.method("PUT", body)
.addHeader("Content-Type", "application/json")
.addHeader("Authorization", "Bearer yourBearerTokenHere")
.build();
Response response = client.newCall(request).execute();
var https = require('follow-redirects').https;
var fs = require('fs');
var options = {
'method': 'PUT',
'hostname': 'api.locate2u.com',
'path': '/api/v1/shipments/105333/cost-lines/1194848',
'headers': {
'Content-Type': 'application/json',
'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);
});
});
var postData = JSON.stringify({
"description": "Update Fuel charge",
"quantity": 1,
"unitPriceExTax": 50
});
req.write(postData);
req.end();
'https://api.locate2u.com/api/v1/shipments/105333/cost-lines/1194848',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'PUT',
CURLOPT_POSTFIELDS =>'{
"description": "Update Fuel charge",
"quantity": 1,
"unitPriceExTax": 50
}',
CURLOPT_HTTPHEADER => array(
'Content-Type: application/json',
'Authorization: Bearer yourBearerTokenHere'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
import requests
import json
url = "https://api.locate2u.com/api/v1/shipments/105333/cost-lines/1194848"
payload = json.dumps({
"description": "Update Fuel charge",
"quantity": 1,
"unitPriceExTax": 50
})
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer yourBearerTokenHere'
}
response = requests.request("PUT", url, headers=headers, data=payload)
print(response.text)
Response
Response codes
200 Success
401 Unauthorized
403 Forbidden