Get Extracted Results For Invoices In a Batch Id

Endpoint Name: getbatchdocuments

Endpoint Details:API is used to get the extracted data/results for invoices that belong to a specific batch id.

Authorization: Bearer token as header

Request Type

Method

URL

POST

URL/access/klearstack/getbatchdocuments

Request Body

Type

Params

Values

Description

POST

company_name

string

Name of the company

POST

username

string

Username for a particular user of a company

POST

password

string

Password for a particular user of a company

POST

batch_id

string

Batch ID of a specific batch.

POST

approve_flag

string

If approve_flag is true, then it returns the invoices which are approved.

POST

save_flag

string

If save_flag is true, then it returns the invoices which are saved

Request Code Samples

Shell

  • Request Body

curl -X POST "URL/access/klearstack/getbatchdocuments" \
  -H "Authorization: Bearer your_token_here" \
  -H "Content-Type: application/json" \
  -d '{
    "company_name": "Replace_Company_Name_Here",
    "username": "Replace_User_Name_Here",
    "password": "Replace_Password_Here",
    "batch_id": "Replace_Batch_ID_Here",
    "approve_flag": "true",
    "save_flag": "false"
  }'

Python

  • Request Body

import requests

# API URL
url = "URL/access/klearstack/getbatchdocuments"

# Request payload
data= {
    "company_name": "Replace_Company_Name_Here",
    "username": "Replace_User_Name_Here",
    "password": "Replace_Password_Here",
    "batch_id": "Replace_Batch_ID_Here",
    "approve_flag": "true",
    "save_flag": "false"
}

# Headers
headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer your_token_here"
}

# Make the POST request
response = requests.post(url, data=data, headers=headers)

# Print the response
if response.status_code == 200:
    print(response.json())
else:
    print("Error:", response.text)

Java

  • Request Body

import okhttp3.*;

import java.io.IOException;

public class GetBatchDocumentsAPI {
    public static void main(String[] args) {
        OkHttpClient client = new OkHttpClient();

        // JSON payload
        String jsonPayload = "{ \"company_name\": \"Replace_Company_Name_Here\", " +
                "\"username\": \"Replace_User_Name_Here\", " +
                "\"password\": \"Replace_Password_Here\", " +
                "\"batch_id\": \"Replace_Batch_ID_Here\", " +
                "\"approve_flag\": \"true\", " +
                "\"save_flag\": \"false\" }";

        RequestBody body = RequestBody.create(
            jsonPayload, MediaType.parse("application/json"));

        Request request = new Request.Builder()
            .url("URL/access/klearstack/getbatchdocuments")
            .post(body)
            .addHeader("Content-Type", "application/json")
            .addHeader("Authorization", "Bearer your_token_here")
            .build();

        try (Response response = client.newCall(request).execute()) {
            if (response.isSuccessful()) {
                System.out.println("Response: " + response.body().string());
            } else {
                System.out.println("Error: " + response.body().string());
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}

Node.js

  • Request Body

var request = require('request');

const form_data = {
  'company_name': 'Replace_Company_Name_Here',
  'username': 'Replace_User_Name_Here',
  'password': 'Replace_Password_Here',
  'batch_id': 'Replace_Batch_ID_Here',
  'approve_flag': 'true',
  'save_flag': 'true'
};

const options = {
  url: 'URL/access/klearstack/getbatchdocuments',
  formData: form_data,
  headers: {
    'Content-Type': 'application/x-www-form-urlencoded',
    'Authorization': 'Bearer your_token_here'
  }
};

request.post(options, function(err, httpResponse, body) {
  if (err) {
    console.error('Request failed:', err);
    return;
  }

  console.log('Response:', body);
});

JavaScript (XMLHttpRequest)

  • Request Body

var payload = JSON.stringify({
    company_name: "Replace_Company_Name_Here",
    username: "Replace_User_Name_Here",
    password: "Replace_Password_Here",
    batch_id: "Replace_Batch_ID_Here",
    approve_flag: "true",
    save_flag: "false"
});

var xhr = new XMLHttpRequest();
xhr.open("POST", "URL/access/klearstack/getbatchdocuments", true);
xhr.setRequestHeader("Content-Type", "application/json");
xhr.setRequestHeader("Authorization", "Bearer your_token_here");

// Handle response
xhr.onreadystatechange = function () {
    if (xhr.readyState === XMLHttpRequest.DONE) {
        if (xhr.status === 200) {
            console.log("Response:", xhr.responseText);
        } else {
            console.error("Error:", xhr.responseText);
        }
    }
};

// Send request
xhr.send(payload);

Last updated