List-Invoices
This API is used to get the list of invoices created by merchant By providing correct/required filters with the correct access token, merchant user will get a list of invoices created in JSON format.
Filters
- Pagination Filters:
Value of skip determines starting number page and limit determines ending number of page
These filters are required with other filters
Example: ?filter[skip]=0&filter[limit]=10 - Clientname Filter:
To fetch invoices by provided client name in invoice
Example: ?filter[skip]=0&filter[limit]=10&filter[clientname]=test - Date Filter:
To fetch invoices from by provided date
Date should be in proper format: YYYY-MM-DD
Example: ?filter[skip]=0&filter[limit]=10&filter[date]=2020-10-24 - Invoice Number Filter:
To fetch invoice by provided invoice number
Example: ?filter[skip]=0&filter[limit]=10&filter[invoicenumber]=SD20XXXXXXXXXXX - Status Filter:
To fetch invoices by provided status of invoices
Example: ?filter[skip]=0&filter[limit]=10&filter[status]=5
Status Description 1 - Draft 2 - Unpaid 3 - Paid 4 - Overdue 5 - Cancelled
sentviaId Description 1 - None 2 - Whatsapp 3 - Email 4 - SMS
- GET
Sandbox
https://api-sandbox.sadad.qa/api/invoices/listInvoices
Live
https://api-s.sadad.qa/api/invoices/listInvoices
Permission: Merchant
- Curl
- Ruby
- Python
- PHP
- Java
- Node.js
- Go
- .NET
curl -H "Content-Type: application/json" -H "Authorization: {ACCESS_TOKEN}" -X GET https://api-s.sadad.qa/api/invoices/listInvoices?filter[skip]=0&filter[limit]=10
require 'net/http'
require 'uri'
uri = URI("https://api-s.sadad.qa/api/invoices/listInvoices?filter[skip]=0&filter[limit]=10")
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Get.new(uri)
request["Content-Type"] = "application/json"
request["Authorization"] = "{ACCESS_TOKEN}"
response = http.request(request)
puts response.body
import requests
url = "https://api-s.sadad.qa/api/invoices/listInvoices"
params = {
"filter[skip]": 0,
"filter[limit]": 10
}
headers = {
"Content-Type": "application/json",
"Authorization": "{ACCESS_TOKEN}"
}
response = requests.get(url, headers=headers, params=params)
print(response.text)
<?php
$url = "https://api-s.sadad.qa/api/invoices/listInvoices?filter[skip]=0&filter[limit]=10";
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"Content-Type: application/json",
"Authorization: {ACCESS_TOKEN}"
]);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
?>
import java.net.HttpURLConnection;
import java.net.URL;
public class ListInvoices {
public static void main(String[] args) throws Exception {
URL url = new URL("https://api-s.sadad.qa/api/invoices/listInvoices?filter[skip]=0&filter[limit]=10");
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("GET");
conn.setRequestProperty("Content-Type", "application/json");
conn.setRequestProperty("Authorization", "{ACCESS_TOKEN}");
int responseCode = conn.getResponseCode();
System.out.println("Response Code: " + responseCode);
}
}
fetch("https://api-s.sadad.qa/api/invoices/listInvoices?filter[skip]=0&filter[limit]=10", {
method: "GET",
headers: {
"Content-Type": "application/json",
"Authorization": "{ACCESS_TOKEN}"
}
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error(error));
package main
import (
"fmt"
"net/http"
)
func main() {
url := "https://api-s.sadad.qa/api/invoices/listInvoices?filter[skip]=0&filter[limit]=10"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Authorization", "{ACCESS_TOKEN}")
client := &http.Client{}
resp, _ := client.Do(req)
fmt.Println(resp.Status)
}
using System;
using System.Net.Http;
using System.Threading.Tasks;
class Program
{
static async Task Main()
{
var client = new HttpClient();
client.DefaultRequestHeaders.Add("Authorization", "{ACCESS_TOKEN}");
var response = await client.GetAsync("https://api-s.sadad.qa/api/invoices/listInvoices?filter[skip]=0&filter[limit]=10");
var result = await response.Content.ReadAsStringAsync();
Console.WriteLine(result);
}
}
Header
| Field | Type | Description |
|---|---|---|
| Authorization | String | User's unique access-token |
- Header-Example:
{
"Authorization": "BN79o6YNrY4IPP60UF4JmNEM6O8hX9HVUq0e0HWNyo2tt1jqCT9IWnXSBhfr7Mws"
}
Success 200
| Field | Type | Description |
|---|---|---|
| invoiceno | String | Unique invoice number |
| clientname | String | Name of thee client on invoice |
| cellno | String | Cell number of invoice |
| emailaddress | String | Email address of invoice |
| remarks | String | Remarks of invoice |
| grossamount | Number | Amount of invoice |
| readreceipt | Boolean | Invoice is read or not |
| readdatetime | String | Date and time of read invoice |
| is_archived | Number | Invoice is archived or not |
| id | Number | Unique id of invoice data |
| date | String | Date of the invoice created |
| sentviaId | Number | How the invoice is shared. 1 - none, 2 - whatsapp, 3 - email, 4 - mobile |
| grossamount | Number | Amount of invoice |
| invoicestatusId | Number | Invoice status Id (Brief details will be in invoice status parameter) |
| invoicereceiverId | Object | Details of invoice receiver like SadadId, name, cellnumber |
| invoicesenderId | Object | Details of invoice sender like SadadId, name, cellnumber |
| invoicestatus | Object | Invoice status details with id and status name |
| invoicedetails | ArrayObject | Array object of product if any product associated with invoice. This object contains description, amount, quantity of product along with its invoice id |
- Success-Response:
[
{
"invoiceno": "SD202101761399",
"clientname": "test test",
"cellno": "91-76XXXXXXX2",
"emailaddress": null,
"remarks": "invoice test remarks",
"grossamount": 15,
"readreceipt": true,
"readdatetime": null,
"is_archived": 0,
"id": 8888,
"date": "2021-01-04",
"sentviaId": 1,
"invoicestatusId": 2,
"invoicereceiverId": {
"SadadId": "2470962",
"name": "User1",
"cellnumber": "76XXXXXXX2",
"id": 1817
},
"invoicesenderId": {
"SadadId": "1853219",
"name": "User2",
"cellnumber": "54XXXXX5",
"id": 466
},
"invoicestatus": {
"name": "Unpaid",
"id": 2
},
"invoicedetails": [
{
"description": "invoice test 1",
"quantity": 1,
"amount": 10,
"invoiceId": 8888
},
{
"description": "invoice test 1",
"quantity": 2,
"amount": 10,
"invoiceId": 8888
},
{
"description": "invoice test 3",
"quantity": 3,
"amount": 10,
"invoiceId": 8888
}
]
}
]
Error 4xx
| Name | Description |
|---|---|
| 401 | Authorization Required |
| 400 | Invalid data |
| 404 | Data not found |
- Response (example):
{
"error": {
"statusCode": 401,
"name": "Error",
"message": "Authorization Required"
}
}