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: 0 = from the start (or a period, with DateFrom/DateTo), a number = only changes after it, -1 = Logic ERP keeps the bookmark for you.
DateFrom, DateTo
date
No
empty
With GlobalModifyCode 0: a period of changes (the date a return was saved or edited). Send both as null or leave them out when you are not asking for a period. With Doc_Codes, DateFrom 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, read in batches of the size set for your API site (150 lines when none is set). 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.Caught up. When nothing has been added to the change log after your bookmark (or nothing that matches
Doc_Num_Like), the answer is"No Purchase Return found..."withStatus: trueandLastGlobalModifyCodeequal to the value you sent.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.
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: 0 = from the start (or a period, with DateFrom/DateTo), a number = only changes after it, -1 = Logic ERP keeps the bookmark for you.
With GlobalModifyCode 0: a period of changes (the date a return was saved or edited). Send both as null or leave them out when you are not asking for a period. With Doc_Codes, DateFrom 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 or leave them out when you are not asking for a period. With Doc_Codes, DateFrom 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.
See the Status rules on this page and on How Every API Call Works.
Why the call failed, or a note. The reason may be followed by technical detail - read the first line.
The change-log bookmark (see How Every API Call Works).
Size of the answer, for example "2 KB".
No login was sent.
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
}{
"GetData": [
{
"Vouch_Code": 1,
"Vouch_No": "text",
"Vouch_Date": "text",
"Account_Code": "text",
"Account_Name": "text",
"Agent_Name": "text",
"Quantity": 1,
"Gross_Amount": 1,
"Net_Amount": 1,
"Total_Tax": "text",
"Branch_Name": "text",
"Branch_Code": 1,
"Currency_Name": "text",
"Bill_No": "text",
"Bill_Date": "text",
"GRN_Prefix": "text",
"GRN_Number": 1,
"Tax_Region_Name": "text",
"Goods_In_Transit": 1,
"Action_Code": "text",
"Doc_Type_Desc": "text",
"Doc_Type": "text",
"Gr_Number": "text",
"Gr_Date": "text",
"Order_No": "text",
"Order_Date": "text",
"Header_Remarks_1": "text",
"Header_Remarks_2": "text",
"Header_Remarks_3": "text",
"Transport_Mode": "text",
"Transport_Name": "text",
"Trans_ID": "text",
"Trans_Services": "text",
"Weight": "text",
"Cases": "text",
"GPN_Number": "text",
"GPN_Date": "text",
"ListItems": [
{
"Pur_Txn_Code": 1,
"Lot_Code": 1,
"Lot_Number": "text",
"AddlItemCode": "text",
"ItemCode": "text",
"PackName": "text",
"CF_1": 1,
"CF_2": 1,
"CF_3": 1,
"Item_Sale_Rate": 1,
"Item_Sp_Rate_1": 1,
"Item_Sp_Rate_2": 1,
"Item_Sp_Rate_3": 1,
"Item_Sp_Rate_4": 1,
"Item_Sp_Rate_5": 1,
"Item_Pur_Rate": 1,
"Item_MRP": 1,
"HSN_Code": "text",
"Quantity": 1,
"Lot_MRP": 1,
"Rate": 1,
"Tax_Amt_1": 1,
"Tax_Amt_3": 1,
"Pur_MRP": 1,
"Pur_Gross_Amt": 1,
"Pur_Net_Amt": 1,
"Pur_Round_Amt": 1,
"Pur_Net_Rate": 1,
"Gross_Pur_Amt": 1,
"CD": 1,
"TD": 1,
"SP_CD": 1,
"Scheme_Unit": 1,
"Scheme_Rs": 1,
"Freight": 1,
"Adjust_Item": 1,
"Handling": 1,
"Postage": 1,
"ExciseUnit": 1,
"ExcisePercentage": 1,
"CD_Per": 1,
"TD_Per": 1,
"SP_CD_Per": 1,
"Tax_P_1": 1,
"Tax_P_2": 1,
"Tax_P_3": 1,
"Qty_Scanned": 1,
"Qty_Rejected": 1,
"Qty_Excess": 1,
"ItemName": "text",
"ItemHDName": "text",
"ColorName": "text",
"ItemDesc_1": "text",
"CompanyName": "text",
"HSN_Serial_No": "text",
"HSN_Description": "text",
"HSN_UOM": "text",
"Packing": "text",
"Item_Group_Name_1": "text",
"LotPcsInfo": [
{}
]
}
]
}
],
"Status": true,
"Message": "text",
"LastGlobalModifyCode": 1,
"resultSize": "text"
}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 Purchase Return found... (with Status: true)
Nothing has been added to the change log after your bookmark.
You are up to date. Call again later with the same bookmark.
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.
Invalid code in list: '…'. Only numeric codes are allowed. (with Status: false)
Doc_Codes or Branch_Codes_From contained something other than numbers and commas.
Send numbers separated by commas.
No code or sub-query supplied. (with Status: false)
Doc_Codes holds only spaces.
Send numbers separated by commas, or leave the field out.
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