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
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
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."withStatus: trueand a higherLastGlobalModifyCode– 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_NumberandGPN_Dateare always empty, and the lines are never repeated.Qty_Scanned,Qty_RejectedandQty_Excessare always0.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 withStatus: true, an emptyMessageandLastGlobalModifyCodeequal to the value you sent. CompareLastGlobalModifyCodewith the bookmark you sent: when they are the same, you are up to date – ignoreGetDataand 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
0and in a period request). The return of the earlier year is not returned, and an unrelated current-year return with the sameVouch_Codemay be returned instead. Check thatVouch_Dateis in the financial year you expect before you store a record byVouch_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.
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 user name and password of your API site.
Your bookmark in the change log, as described in How Every API Call Works. See the known issue below before you rely on it.
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.
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.
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 separated by commas, for example "2,5". Only returns of these branches are returned. Numbers and commas only.
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.
Always HTTP 200. Check Status, Message and GetData.
No login was sent.
No content
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:
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
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