It allows you:
to insert new sales orders (master document)
to process existent sales orders (Change Document Action: Prepare, Complete, Void etc)
to update, delete existing orders
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 sales orders master document data - ordered descending by created date and document date
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 a Customer active with all the mandatory fields
to have a price list active
Columns that can be used as filters:
Organization
DocumentNo
OrderReference
BPartner
DateOrdered
IsSelfService
DocumentStatus
PriceList
CreatedBy
AssetValue
AssetSN
Employee
Project
ProjectPhase
HasPartialPayments (true/false)
Actions can be done:
list
insert
update
delete
add attachment
delete attachment
Sales Order fields (Master Document)
A Sales Order in SocrateCloud has the following structure:
Master document which contains data about header document:
No. document
Order data
Customer
Sales Reprezentative etc.
Document details (see 04.1 Sales Order Details) which contains the products that are ordered with informations about:
Product
Quantity
Selling price
VAT
Note: We recommend to attend the following steps:
1. If new customer create customer using BPartner create method
2. Create Order with DocumentAction=null -> the result will be an Sales Order with DocumentStatus='Draft', for e g: DocumentNo: 60300
3. Create lines order into the Sales Order no: 60300
4. Process Sales Order no: 60300 using process method by sending the following parameters: Document Number and Document Action.
URL: https://api.socratecloud.com/webapi/rest/order/list/{version}?startRow={0}&endRow={100}&accessToken={access_token}
Method: GET
Return: JSON object with next format:
{
"data": [
{
"Organization": "Demo SRL",
"Created": "2014-01-17 09:11:53",
"CreatedBy": "Admin",
"Updated": "2014-05-07 23:44:18",
"UpdatedBy": "Admin",
"DocumentNo": "60300",
"OrderReference": null,
"Description": "A1 | ** Anulată",
"DocType": "Standard Order",
"DateOrdered": "2014-01-28 00:00:00",
"DatePromised": "2014-01-28 00:00:00",
"BPartner": "Client 01",
"BPartnerName": "Client 01",
"BPartnerLocation": "STRADA",
"BillBPartnerTaxID": "RO 1234567",
"BillBPartnerIsIndividual": false,
"BillBPartnerIsTaxIDValid": false,
"BillBPartner": "Client 01",
"BillBPartnerName": "Client 01",
"BillLocation": "STRADA",
"BPartnerContact": "office",
"BPartnerContactEmail": "mirelaromsan14@gmail.com",
"BPartnerContactPhone": "0740000000",
"BPartnerContactPhone2": "0740000000",
"BillContact": "office",
"BillContactEmail": "mirelaromsan14@gmail.com",
"BillContactPhone": "0740000000",
"BillContactPhone2": "0740000000",
"Warehouse": "Standard",
"DeliveryRule": "Manual",
"DeliveryViaRule": "Shipper",
"Shipper": null,
"DeliveryTerms": null,
"Currency": "RON",
"SalesRep": "User 1",
"PaymentTerm": "30 days",
"InvoiceRule": "After Order delivered",
"TrxOrganization": null,
"Activity": "Programare",
"User1_ID": 1053396,
"User1": "1068",
"TotalLines": 0,
"GrandTotal": 0,
"PaidAmt": "10.0",
"OpenAmt":"250.5",
"DocumentStatus": "Voided",
"DocumentAction": "Complete",
"PaymentMethod": "On Credit",
"PriceList": "Standard EUR",
"IsSelfService": true,
"BillSendLocation": null,
"PaymentMode": null,
"ReceiptNo": 1,
"AssetValue": "9195",
"AssetSN": null,
"Employee": "Loredan",
"Project" : null,
"ProjectPhase": null,
"Status_ID": 1000080,
"Status": "Creată",
"BPartnerSR": "Agent Value",
"BPartnerSRName": "Agent Name",
"comments": [
{
"Comments": "test1"
}
]
}
],
"totalRows": 17
}
URL: https://api.socratecloud.com/webapi/rest/order/create/{version}?accessToken={access_token}
Method: POST
Return: document no for success or error message (start with "ERROR: ")
Data format:
{
"Organization": "Demo SRL",
"DocumentNo": "60300",
"OrderReference": null,
"Description": "some_description",
"DocType": "Standard Order",
"DateOrdered": "2014-11-13 00:00:00+0000",
"DatePromised": "2014-11-13 00:00:00+0000",
"BPartner": "Client 01",
"BPartnerLocation": "STRADA",
"BillBPartner": "Client 01",
"BillLocation": "STRADA",
"BPartnerContact": "office",
"BPartnerContactEmail": "mirelaromsan14@gmail.com",
"BPartnerContactPhone": "0740000000",
"BPartnerContactPhone2": "0740000000",
"BillContact": "office",
"BillContactEmail": "mirelaromsan14@gmail.com",
"BillContactPhone": "0740000000",
"BillContactPhone2": "0740000000",
"Warehouse": "Standard",
"DeliveryRule": "Manual",
"DeliveryViaRule": "Shipper",
"Shipper": null,
"DeliveryTerms": null,
"SalesRep": "Ionut Ursuleanu",
"PaymentTerm": "30 days",
"InvoiceRule": "After Order delivered",
"TrxOrganization": null,
"Activity": "Programare",
"User1_ID": 1053396,
"User1": "1068",
"DocumentAction": "<None>",
"PaymentMethod": "On Credit",
"PriceList": "Standard EUR",
"IsSelfService": true,
"BillSendLocation": null,
"PaymentMode": null,
"ReceiptNo": 1,
"AssetValue": "9195",
"AssetSN": null,
"Employee": "Loredan",
"Project" : null,
"ProjectPhase": null,
"Status_ID": 1000080,
"Status": "Creată",
"BPartnerSR": "Agent Value",
"BPartnerSRName": "Agent Name",
"comments": [
{
"Comments": "test1"
}
]
}
URL: https://api.socratecloud.com/webapi/rest/order/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", // NOT UPDATABLE !!! (business logic reason)
"DocumentNo": "60300",
"OrderReference": null,
"Description": "some_description",
"DocType": "Standard Order",
"DateOrdered": "2014-01-28 00:00:00",
"DatePromised": "2014-01-28 00:00:00",
"BPartner": "Client 01", // NOT UPDATABLE !!! (business logic reason)
"BPartnerLocation": "STRADA",
"BillBPartner": "Client 01",
"BillLocation": "STRADA",
"BPartnerContact": "office",
"BPartnerContactEmail": "mirelaromsan14@gmail.com",
"BPartnerContactPhone": "0740000000",
"BPartnerContactPhone2": "0740000000",
"BillContact": "office",
"BillContactEmail": "mirelaromsan14@gmail.com",
"BillContactPhone": "0740000000",
"BillContactPhone2": "0740000000",
"Warehouse": "Standard", // NOT UPDATABLE !!! (business logic reason)
"DeliveryRule": "Manual",
"DeliveryViaRule": "Shipper",
"Shipper": null,
"DeliveryTerms": null,
"SalesRep": "Ionut Ursuleanu",
"PaymentTerm": "30 days",
"InvoiceRule": "After Order delivered",
"TrxOrganization": null,
"Activity": "Programare",
"User1_ID": 1053396,
"User1": "1068",
"DocumentAction": "<None>",
"PaymentMethod": "On Credit",
"PriceList": "Standard EUR", // NOT UPDATABLE !!! (business logic reason)
"IsSelfService": true,
"BillSendLocation": null,
"PaymentMode": null,
"ReceiptNo": 1,
"AssetValue": "9195",
"AssetSN": null,
"Employee": "Loredan",
"Project" : null,
"ProjectPhase": null,
"Status_ID": 1000080,
"Status": "Creată",
"BPartnerSR": "Agent Value",
"BPartnerSRName": "Agent Name",
"comments": [
{
"Comments": "test1"
}
]
}
Note: If you don't transmit a field, then the value of that field will be deleted!! (except of not updatable fields)
URL: https://api.socratecloud.com/webapi/rest/order/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/order/process/{version}?accessToken={access_token}&DocumentNo={document_no}&DocumentAction={document_action}
Method: POST
Optional parameters:
VoidReason - Void reason name as defined in SocrateCloud. Applicable only for DocumentAction = 'Void' or 'Reverse - Correct'.
Return: Document status for success or error message (start with "ERROR: ")
Get attachment:
URL: https://api.socratecloud.com/webapi/rest/order/attachment/{version}?accessToken={access_token}&DocumentNo={documentNo}&FileName={file_name}
Method: GET
Return: File
Add attachment:
URL: https://api.socratecloud.com/webapi/rest/order/attachment/add/{version}?accessToken={access_token}&DocumentNo={documentNo}&FileName={file_name}
Method: POST
Return 'Ok' for success or error message (start with "ERROR: ")
Delete attachment:
URL: https://api.socratecloud.com/webapi/rest/order/attachment/delete/{version}?accessToken={access_token}&DocumentNo={documentNo}&FileName={file_name}
Method: POST
Return 'Ok' for success or error message (start with "ERROR: ")
List attachment:
URL: https://api.socratecloud.com/webapi/rest/order/attachment/list/{version}?startRow={0}&endRow={100}&accessToken={access_token}&DocumentNo={documentNo}
Method: GET
Return: JSON with the following format
{
"data": [
{
"FileName": "20x20.gif",
"Bytes": 784
},
{
"FileName": "800x600.jpg",
"Bytes": 7767
}
],
"totalRows": 2
}