Delete Line Item
To delete an existing line item, submit a DELETE request with the corresponding line item ID.
Delete line item
DELETE
https://api.photoncommerce.com/api/v4/update/line-items/<line-item-id>
This method can be used to delete one line item at a time.
Path Parameters
The ID of the line item that needs to be
deleted
Photon Key of the JSON file that needs to
be updated
Unique client-id provided upon user
registration
Pass your username and password in the
form 'apikey <your-username>:<your-api-key>'
Password used during user registration
Set to "application/json"
{"message":"Deleted line item successfully","status":"success"}
Syntax for sending a POST request to delete an existing line item:
curl -X DELETE -H 'Content-Type: application/json' -H "CLIENT-ID:<client-id>" -H "AUTHORIZATION:apikey <username>:<api-key>" -H 'PASSWORD:<password>' -H "SECRET-KEY:<secret-key>" "https://api.photoncommerce.com/api/v4/update/line-items/<line-item-id>?api_key=<your-api-key>&photon_key=<mention-the-photon-key-here>
import requests
headers = {
'Content-Type': 'application/json',
'CLIENT-ID': '<client-id>',
'AUTHORIZATION': 'apikey <username>:<api-key>',
'PASSWORD': '<password>',
'SECRET-KEY': '<secret-key>',
}
params = (
('photon_key', '<mention-the-photon-key-here>'),
)
response = requests.delete('https://api.photoncommerce.com/api/v4/update/line-items/<line-item-id>', headers=headers, params=params)
var request = require('request');
var headers = {
'Content-Type': 'application/json',
'CLIENT-ID': '<client-id>',
'AUTHORIZATION': 'apikey <username>:<api-key>',
'PASSWORD': '<password>',
'SECRET-KEY': '<secret-key>'
};
var options = {
url: 'https://api.photoncommerce.com/api/v4/update/line-items/<line-item-id>?photon_key=<mention-the-photon-key-here>',
method: 'DELETE',
headers: headers
};
function callback(error, response, body) {
if (!error && response.statusCode == 200) {
console.log(body);
}
}
request(options, callback);
import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.Scanner;
class Main {
public static void main(String[] args) throws IOException {
URL url = new URL("https://api.photoncommerce.com/api/v4/update/line-items/<line-item-id>?photon_key=<mention-the-photon-key-here>");
HttpURLConnection httpConn = (HttpURLConnection) url.openConnection();
httpConn.setRequestMethod("DELETE");
httpConn.setRequestProperty("Content-Type", "application/json");
httpConn.setRequestProperty("CLIENT-ID", "<client-id>");
httpConn.setRequestProperty("AUTHORIZATION", "apikey <username>:<api-key>");
httpConn.setRequestProperty("PASSWORD", "<password>");
httpConn.setRequestProperty("SECRET-KEY", "<secret-key>");
InputStream responseStream = httpConn.getResponseCode() / 100 == 2
? httpConn.getInputStream()
: httpConn.getErrorStream();
Scanner s = new Scanner(responseStream).useDelimiter("\\A");
String response = s.hasNext() ? s.next() : "";
System.out.println(response);
}
}