For the complete documentation index, see llms.txt. This page is also available as Markdown.

Get Purchase Returns

Returns your purchase returns (goods you sent back to your suppliers) from Logic ERP, each with its header and item lines. Use it to copy new and changed returns into your own system — normally by asking only for returns added or changed since your last call — or to fetch particular returns by their internal number.

The response has exactly the same layout as Get Purchase Vouchers; this page lists only what is different for returns.

Endpoint

Name
Detail

Address

https://your-server/api/GetPurchaseReturn

Method

POST

Authorization

Basic Auth

The response and the common request fields are explained in How Every API Call Works.

Request fields

Field
Type
Required
Default
Meaning

GlobalModifyCode

number

No

0

Your bookmark in the change log, as described in How Every API Call Works. See the known issue below before you rely on it.

DateFrom, DateTo

date

No

empty

With GlobalModifyCode 0: a period of changes (the date a return was saved or edited). Send both as null when you are not asking for a period. Also decides the financial year searched, as on Get Purchase Vouchers. Write them as yyyy-MM-dd.

Doc_Codes

text

No

empty

Logic ERP's internal return numbers (Vouch_Code), separated by commas, for example "10,11". Returns exactly these returns; the bookmark and period are ignored. Numbers and commas only.

Branch_Codes_From

text

No

empty

Branch codes separated by commas, for example "2,5". Only returns of these branches are returned. Numbers and commas only.

Doc_Num_Like

text

No

empty

Only returns whose internal number starts with this text: PR followed by the return date as yyyyMMdd, for example "PR202607". Used with the bookmark or a period.

Field names are matched without regard to upper or lower case. Other fields in the request (for example PartyUserCode, Branch_Codes_To) are ignored.

Rules Logic ERP applies

The rules of Get Purchase Vouchers apply, with these differences:

  • Only purchase returns are returned – every document saved as a purchase return, whether or not it is marked as a stock transfer.

  • Shared change log. Purchase vouchers, purchase returns and stock transfers in share one change log of up to 150 lines per batch. A batch can hold no returns: you then get "No Record Found." with Status: true and a higher LastGlobalModifyCode – store it and call again. Keep this endpoint's bookmark separate from the bookmark you use for Get Purchase Vouchers.

  • No "caught up" message. When nothing has been added to the change log after your bookmark, this endpoint does not answer with a "nothing found" message – see the known issue.

  • Returns have no gate pass: GPN_Number and GPN_Date are always empty, and the lines are never repeated.

  • Qty_Scanned, Qty_Rejected and Qty_Excess are always 0.

  • Returns use their own API site settings: the branches, series (GRN prefixes) and field choice your Logic ERP team set for purchase returns.

Known issue – every return of the year when you are up to date. When the change log has nothing after your bookmark (or nothing that matches Doc_Num_Like), the endpoint returns every purchase return of the financial year with Status: true, an empty Message and LastGlobalModifyCode equal to the value you sent. Compare LastGlobalModifyCode with the bookmark you sent: when they are the same, you are up to date – ignore GetData and call again later.

Known issue – change-log lines of an earlier financial year. As on Get Purchase Vouchers, a change-log line of a return (or voucher, or stock transfer in) of an earlier financial year is read against the current year (with a bookmark, and also in a first sync from 0 and in a period request). The return of the earlier year is not returned, and an unrelated current-year return with the same Vouch_Code may be returned instead. Check that Vouch_Date is in the financial year you expect before you store a record by Vouch_Code.

Example request

Next batch after your stored bookmark:

Two returns by their internal numbers:

Test it

Send a request to the Logic ERP sandbox (a test company) from this page: open the block below, enter the sandbox user name and password (ask your Logic ERP support team), change the request if you like, and press Test it. The example asks for the first batch of the change log. Do not send "GlobalModifyCode": -1 here – it changes what the sandbox has marked as already sent.

Get Purchase Returns

post

Returns your purchase returns (goods you sent back to your suppliers) from Logic ERP, each with its header and item lines. Use it to copy new and changed returns into your own system — normally by asking only for returns added or changed since your last call — or to fetch particular returns by their internal number.

Authorizations
AuthorizationstringRequired

The user name and password of your API site.

Body
GlobalModifyCodeintegerOptional

Your bookmark in the change log, as described in How Every API Call Works. See the known issue below before you rely on it.

DateFromstring · nullableOptional

With GlobalModifyCode 0: a period of changes (the date a return was saved or edited). Send both as null when you are not asking for a period. Also decides the financial year searched, as on Get Purchase Vouchers. Write them as yyyy-MM-dd.

DateTostring · nullableOptional

With GlobalModifyCode 0: a period of changes (the date a return was saved or edited). Send both as null when you are not asking for a period. Also decides the financial year searched, as on Get Purchase Vouchers. Write them as yyyy-MM-dd.

Doc_CodesstringOptional

Logic ERP's internal return numbers (Vouch_Code), separated by commas, for example "10,11". Returns exactly these returns; the bookmark and period are ignored. Numbers and commas only.

Branch_Codes_FromstringOptional

Branch codes separated by commas, for example "2,5". Only returns of these branches are returned. Numbers and commas only.

Doc_Num_LikestringOptional

Only returns whose internal number starts with this text: PR followed by the return date as yyyyMMdd, for example "PR202607". Used with the bookmark or a period.

Responses
401

No login was sent.

No content

post/GetPurchaseReturn
POST /api/GetPurchaseReturn HTTP/1.1
Host: demo.logicerp.com
Authorization: Basic username:password
Content-Type: application/json
Accept: */*
Content-Length: 52

{
  "GlobalModifyCode": 0,
  "DateFrom": null,
  "DateTo": null
}

No content

Response fields

Every field is the same as in the response of Get Purchase Vouchers (GetData items and ListItems). For a return:

Field
Value for a return

Doc_Type

PR.

Doc_Type_Desc

Purchase Return.

GRN_Prefix, GRN_Number

The return's series prefix and number, for example GRN and 7.

Account_Code, Account_Name

The supplier the goods were sent back to.

Quantity, Gross_Amount, Net_Amount, Total_Tax

Totals of the return, as positive amounts.

ListItems[].Quantity and amounts

Positive.

GPN_Number, GPN_Date

Always empty.

ListItems[].Qty_Scanned, Qty_Rejected, Qty_Excess

Always 0.

Example response

Messages you may see

Message
Meaning
What to do

No Record Found. (with Status: true)

No purchase return matched: the batch held only vouchers, stock transfers in or returns outside your filters, nothing in the period was a return, or the numbers you sent are not returns of that financial year.

With a bookmark: store the new LastGlobalModifyCode and call again. Otherwise: check what you sent.

A database error (with Status: false), for example a message containing Invalid column name 'abc'.

Doc_Codes or Branch_Codes_From contained something other than numbers and commas. The reason may be followed by technical detail – read the first line.

Send numbers separated by commas.

The date messages listed in How Every API Call Works (with Status: true)

A period request with a missing or invalid date.

Send both dates as yyyy-MM-dd, or both as null.

Last updated