Partner endpoint: PostDOC, JSON template and check call
When orders are sent to a service written by your SoftOne partner instead of the standard setData.
There are two sending modes, in Order settings, tab “Advanced”:
- Standard SoftOne (setData). The default. The service builds the document itself.
- Partner endpoint. The service calls a service of your installation, for example
PostDOC_1, and sends it the JSON you define.
Use the second when your partner already has a service that writes orders by your business’s rules. The sending mode locks after the first order.
Endpoint path
It starts with s1services/, for example /s1services/JS/eshop/PostDOC_1.
Fixed parameters
Optional. They are sent with every send, next to the template.
JSON template
The JSON sent to the endpoint. You put order fields inside text values, in double curly braces:
{
"header": {
"REFERENCE": "{{reference}}",
"CUSTOMER": "{{customer.code}}",
"PAYMENT": "{{payment.code}}",
"REMARKS": "{{note}}"
},
"lines": [
{ "$lines": { "CODE": "{{line.sku}}", "QTY": "{{line.quantity}}", "PRICE": "{{line.unitPrice}}", "DISCOUNT": "{{line.discount}}" } }
]
}
This is the app’s default template. The key names (REFERENCE, CODE and the rest) are defined by your partner’s service: change them to match. $lines marks the block that repeats for every order line. All available fields are in the page’s “Available fields” list.
Rules:
{{reference}}is required. Without it the document cannot be found again in the ERP.line.*fields only work inside the lines block, which is the only item of a list.- The
|numberfilter (for example{{line.quantity|number}}) sends the value as a number instead of text, and only applies to numeric fields. - Pressing a field in the list inserts it at the cursor.
Under the template you see a preview with fictitious details, and any problems with their line and column.
Where the document number is in the answer
The path inside the endpoint’s answer, for example data.FINDOC. At least two segments are needed: an error answer lacks that key too and would look like “not found”.
Check call
A second service that asks the ERP whether a document with the order’s reference already exists. It runs before every send. You set:
- the path and the parameters of the call,
- the reference parameter, that is, the name of the parameter that takes the reference,
- where the result is: the path in the answer that has a value only when a document was found,
- optionally where the reference is in the answer. When filled, a document counts only if its reference is exactly the same. Then at least one template value must be exactly
{{reference}}, with no other text.
Press “Test the check call” after you save.
Without a check call
It is allowed, but it has a consequence: a send that got no answer cannot be checked. The order stops as “Needs a check” and waits for you, so that it is not sent twice. See Unknown outcome and resolving.
Ask your partner for a lookup service by reference. It is a small job and saves you manual checks.