Photon Commerce API
  • Getting Started with the Photon Commerce API
    • Register a new account
    • Capture an invoice or receipt in real time
    • Confidence Scores & Coordinates
  • Update Document
    • Update Fields
    • Update Line Items
    • Add Line Item
    • Delete Line Item
  • Retrieve Data
  • Async API
  • Async API Webhook
  • Bank Transaction Categorization
  • Invoice Approvals
  • Status Codes
Powered by GitBook
On this page

Was this helpful?

  1. Update Document

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

Name
Type
Description

line_item_id

string

The ID of the line item that needs to be deleted

photon_key

string

Photon Key of the JSON file that needs to be updated

Headers

Name
Type
Description

CLIENT-ID

string

Unique client-id provided upon user registration

AUTHORIZATION

string

Pass your username and password in the form 'apikey <your-username>:<your-api-key>'

SECRET-KEY

string

Secret key as a string

PASSWORD

string

Password used during user registration

Content-Type

string

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);
	}
}
PreviousAdd Line ItemNextRetrieve Data

Last updated 3 years ago

Was this helpful?