It allows you:
to insert new expense report (master document)
to process (update, delete) existing expense report
for update it is necessary to provide all the updatable fields in JSON even if the value is not changed. The missing fields will get their value removed!
delete will remove all the related details!
to view expense report master document data
Prerequisites:
In order to use this API Method for PUT there must be accomplished the following requirements in SocrateCloud:
to have an Organization active
to have an Warehouse active
to have Business Partners active
to have Employees active
to have a price list active
Columns that can be used as filters:
Organization
DocType
DocumentNo
TaskDocumentNo
BPartner (Employee)
BPartner_ID
DocumentStatus
ExpenseDate
TimeExpense_ID
IsSOTrx (true / false) - if is true - filter is applied on sales price list, if is false - filter is applied on non-sales pricelist
Language (eg: ”ro_RO”, ”en_EN”, ”bg_BG” etc) - if null or unprovided, then English is the base language for Product Name.
Actions can be done:
list
insert
update
delete
process
add attachment
delete attachment
Expense Report fields (Master Document)
An Expense Report in SocrateCloud has the following structure:
Master document which contains data about header document:
Organization
Doc Type
Document No.
Expense Report Date
Employee
Warehouse
Currency
Description
URL: https://api.socratecloud.com/webapi/rest/expense_report/list/0?startRow={0}&endRow={100}&accessToken={access_token}
Method: GET
Available filter parameters:
Organization
DocType
DocumentNo
TaskDocumentNo
BPartner
BPartner_ID
DocumentStatus
ExpenseDate
TimeExpense_ID
IsSOTrx (true / false) - if is true - filter is applied on sales price list, if is false - filter is applied on non-sales pricelist
Language (eg: ”ro_RO”, ”en_EN”, ”bg_BG” etc) - if null or unprovided, then English is the base language for Product Name.
Return: JSON object with next format:
{
"data": [
{
"Organization":"Demo SRL",
"Created":"2014-07-22 06:41:28+0300",
"CreatedBy":"SuperUser",
"Updated":"2014-07-22 06:41:51+0300",
"UpdatedBy":"SuperUser",
"DocType":"Decont",
"DocumentNo":"1000900",
"Description":null,
"ExpenseDate":"2014-07-22 00:00:00+0300",
"BPartner":"EMPLCODE",
"BPartnerName":"EMPLNAME",
"Warehouse":"DEP7",
"PriceList":"EUR Prices",
"TotalLines":600,
"DocumentStatus":"In Progress",
"DocumentAction":"Complete",
"IsPaid": false,
"Customer_ID": null,
"Customer": null,
"CustomerName": "ABC SRL",
"CustomerContact_ID": null,
"CustomerContact": null,
"CustomerContactName": "OFFICE",
}
],
"totalRows":1
}
URL: https://api.socratecloud.com/webapi/rest/expense_report/create/{version}?accessToken={access_token}
Method: POST
Return: document no for success or error message (start with "ERROR: ")
Data format:
{
"Organization":"Demo SRL",
"DocType":"Decont",
"DocumentNo":null,
"Description":null,
"ExpenseDate":"2014-07-22 00:00:00+0300",
"BPartner":"EMPLCODE",
"Warehouse":"DEP7",
"Currency":"",
"DocumentAction":null,
"Customer_ID": null,
"Customer": null,
"CustomerName": "ABC SRL",
"CustomerContact_ID": null,
"CustomerContact": null,
"CustomerContactName": "OFFICE"
}
Create Full:
Method: POST
Return: document no for success or error message (start with "ERROR: ")
Data format:
{ "Organization": "DEMO SRL",
"Created": "2021-03-23 17:29:15+0000",
"CreatedBy": "DEMO_Admin",
"Updated": "2021-03-23 17:47:45+0000",
"UpdatedBy": "DEMO_Admin",
"DocType": "Time Expense",
"DocumentNo": "10004832",
"Description": null,
"ExpenseDate": "2021-03-23 00:00:00+0000",
"StartDate": null,
"EndDate": null,
"BPartner_ID": 1022315,
"BPartner": "Agent Vanzari",
"BPartnerName": "Agent Vanzari",
"Warehouse": "Gestiune_M1",
"Warehouse_ID": 1004356,
"PriceList": "Vanzare RON",
"Currency": "RON",
"TotalLines": 600,
"TaskDocumentNo": "111-1000002",
"TimeExpense_ID": 1010782,
"IsPaid": false,
"Customer_ID": null,
"Customer": null,
"CustomerName": "ABC SRL",
"CustomerContact_ID": null,
"CustomerContact": null,
"CustomerContactName": "OFFICE",
"lines": [
{
"Organization": "TESTMIRELA SRL",
"Created": "2021-03-23 17:47:00+0000",
"CreatedBy": "TESTMIRELA_Admin",
"Updated": "2021-03-23 17:47:45+0000",
"UpdatedBy": "TESTMIRELA_Admin",
"Line": 10,
"DateExpense": "2021-03-23 00:00:00+0000",
"SourceDocNo": "0",
"Product": "1000036",
"SKU": null,
"Product_ID": 1132342,
"ProductName": "Tichete cadou",
"Description": null,
"QtyEntered": 1,
"UOM": "Each",
"Price": 600,
"Amount": 600,
"BPartner": "1000000",
"BPartnerName": "Client_RO_1",
"BPartner_ID": 1022300,
"User_ID": 1017893,
"UserName": "Agent Vanzari",
"VendorName": null,
"TaxID": null,
"IsTimeReport": false,
"IsInvoiced": true,
"Project": "test",
"Project_ID": null,
"ProjectPhase": "faza 1",
"ProjectPhase_ID": null,
"ProjectSubPhase": null,
"ProjectSubPhase_ID": null,
"Activity": null,
"TrxOrganization": null,
"Asset_ID": null,
"AssetValue": null,
"Summary": null,
"InvoicePrice": 588
}
]
}
URL: https://api.socratecloud.com/webapi/rest/expense_report/update/{version}?accessToken={access_token}&DocumentNo={document_no}
Method: POST
Return: document no for success or error message (start with "ERROR: ")
Data format:
{
"Organization":"Demo SRL",
"DocType":"Decont",
"DocumentNo":null,
"Description":null,
"ExpenseDate":"2014-07-22 00:00:00+0300",
"BPartner":"EMPLCODE",
"Warehouse":"DEP7",
"Currency":"EUR",
"DocumentAction":null
}
URL: https://api.socratecloud.com/webapi/rest/expense_report/delete/{version}?accessToken={access_token}&DocumentNo={document_no}
Method: POST
Return: 'Deleted' for success or error message (start with "ERROR: ")
URL: https://api.socratecloud.com/webapi/rest/expense_report/process/{version}?accessToken={access_token}&DocumentNo={document_no}&DocumentAction={document_action}
Available document actions: CO (Complete), VO (Void), CL (Close), PR (Prepare), AP (Approve)
Method: POST
Return: Document status for success or error message (start with "ERROR: ")
Add attachment:
Files can be added in .jpg or .pdf format, with the picture of the signature or in other purposes.
URL: https://api.socratecloud.com/webapi/rest/expense_report/attachment/add/{version}?accessToken={acess_token}&DocumentNo={document_no}&FileName={file_name}
Method: POST
Return: "Ok" for success or error message (start with "ERROR: ")
Content-Type: multipart/form-data; boundary={boundary}
--boundary
Content-Disposition: attachment;
filename : "{filename}"
Content-Type: {mime_type}
raw document data
Delete Attachment:
URL: https://api.socratecloud.com/webapi/rest/expense_report/attachment/delete/{version}?accessToken={acess_token}&DocumentNo={document_no}&FileName={file_name}
Method: POST
Return: "Ok" for success or error message (start with "ERROR: ")