پرش به مطلب اصلی

Get Invoice by Date Range API

POST /getInvoiceByDateRange

Description

This endpoint retrieves invoices that were issued within a specified date range.

Request

Endpoint: /getInvoiceByDateRange

Method: POST

Body:

query getInvoiceByDateRange ($beginDate: String!, $endDate: String!) {
getInvoiceByDateRange (beginDate: $beginDate, endDate: $endDate) {
id
firstName
lastName
clientCompanyName
address
taxId
email
phoneNumber
groupId
amountForGroup
multiLogin
amountForMultiLogin
totalAmount
paymentMethod
paymentDate
invoiceDate
updateDate
}
}

GraphQL Variables:

{
"beginDate": "YYYY-MM-DD",
"endDate": "YYYY-MM-DD"
}

Example Request

cURL:

curl --location 'YOUR_API_ENDPOINT' \
--header 'Content-Type: application/json' \
--data '{"query":"query getInvoiceByDateRange ($beginDate: String!, $endDate: String!) {\n getInvoiceByDateRange (beginDate: $beginDate, endDate: $endDate) {\n id\n firstName\n lastName\n clientCompanyName\n address\n taxId\n email\n phoneNumber\n groupId\n amountForGroup\n multiLogin\n amountForMultiLogin\n totalAmount\n paymentMethod\n paymentDate\n invoiceDate\n updateDate\n }\n}","variables":{"beginDate":"2024-01-01","endDate":"2024-01-31"}}'

Response

The response will include a list of invoices with the following fields:

  • id: Unique identifier of the invoice.
  • firstName: First name of the client.
  • lastName: Last name of the client.
  • clientCompanyName: Company name of the client.
  • address: Address of the client.
  • taxId: Tax identification number of the client.
  • email: Email address of the client.
  • phoneNumber: Phone number of the client.
  • groupId: Group ID associated with the invoice.
  • amountForGroup: Amount billed for the group.
  • multiLogin: Number of multi-logins billed.
  • amountForMultiLogin: Amount billed for multi-logins.
  • totalAmount: Total amount of the invoice.
  • paymentMethod: Method used for payment.
  • paymentDate: Date when the payment was made.
  • invoiceDate: Date when the invoice was issued.
  • updateDate: Date when the invoice was last updated.

Errors

  • 400 Bad Request: Invalid date format or missing date parameters.
  • 404 Not Found: No invoices found within the specified date range.
  • 500 Internal Server Error: Server error while processing the request.

Notes

  • Ensure that beginDate and endDate are in YYYY-MM-DD format and represent valid dates.
  • The date range should not exceed reasonable limits, as extensive ranges might impact performance.
  • The response includes sensitive client information. Ensure proper access controls and permissions are in place.
  • If no invoices are found within the specified date range, the response should handle this gracefully, potentially returning an empty list or an appropriate message.