PUT api/v1/shipments/{shipmentId}/charge-lines/{chargeLineId}
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}/charge-lines/{chargeLineId}
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 charge-line.
chargeLineId
chargeLineId* integer($int32) (path). Unique id of the charge 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/175368/charge-lines/1161620");
request.Headers.Add("Authorization", "Bearer yourBearerTokenHere");
var content = new StringContent("{\r\n \"description\": \"Fuel charge\",\r\n \"quantity\": 1,\r\n \"unitPriceExTax\": 10\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\": \"Fuel charge\",\r\n \"quantity\": 1,\r\n \"unitPriceExTax\": 10\r\n}");
Request request = new Request.Builder()
.url("https://api.locate2u.com/api/v1/shipments/175368/charge-lines/1161620")
.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/175368/charge-lines/1161620',
'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": "Fuel charge",
"quantity": 1,
"unitPriceExTax": 10
});
req.write(postData);
req.end();
'https://api.locate2u.com/api/v1/shipments/175368/charge-lines/1161620',
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": "Fuel charge",
"quantity": 1,
"unitPriceExTax": 10
}',
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/175368/charge-lines/1161620"
payload = json.dumps({
"description": "Fuel charge",
"quantity": 1,
"unitPriceExTax": 10
})
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer yourBearerTokenHere'
}
response = requests.request("PUT", url, headers=headers, data=payload)
print(response.text)
Response
The response of this request is a JSON schema representing the updated shipment charge line. The schema includes properties such as id, description, quantity, and unitPriceExTax. The specific structure and data types of these properties will be provided in the response.
Example response schema:
{
"id": "string",
"description": "string",
"quantity": 0,
"unitPriceExTax": 0
}