Lookup and code lists
هذا المحتوى غير متوفر بلغتك بعد.
Lookup
Section titled “Lookup”When you’re not sure whether SLFLO has something — before creating it, say — ask:
GET /lookup?entity=customer&external_ref=CUST-0042
curl -X GET 'https://api.slflo.com/api/integration/v1/lookup?entity=customer&external_ref=CUST-0042' \ -H 'Authorization: Bearer $SLFLO_TOKEN'Response
HTTP 200
{ "data": { "entity": "customer", "id": "C0000001", "number": "CUST-1", "external_ref": "CUST-0042", "external_number": null, "version": 9123, "exists": true }}entityiscustomer,branch,product,unit,price_list,warehouse,order,invoice,payment(orreceipt),return(orcredit_note),van.- A
vanis found by its SLFLO location code asexternal_ref(VAN-03) — the code you send loads to, not a key of yours. The answer addsvan: {rep: {id, code, name}, held_back_code}: whose van it is and its held-back place (VAN-03-Q). A warehouse’s code, or a van taken out of use, is"exists": false. It needsstock:readorstock:write. See Stock from your ERP. - Send
external_ref(yours) orid(ours), not both. - A unit, product or price list your ERP has no key for yet is also found by our code: by
external_refwe look for your key first, then for our row whose code is exactly that ref (same case) and that no key of your ERP system claims. That is the rowPUT /units|products|price-lists/{ref}would adopt, so lookup and push agree. The answer has"external_ref": null— not linked until you push. A row of ours already linked to another of your keys isn’t matched by its code. Customers and branches aren’t adopted by code (a customer push namessalflo_id), so lookup doesn’t match their codes either. - A miss — never known, another company’s, or deleted since — is
"exists": false, not a 404. - It needs a scope of the entity’s family: a customers scope for a customer or branch,
catalog:writefor a product or unit,prices:writefor a price list,catalog:writeor a stock scope for a warehouse or a van, and the read or write scope for an order, invoice, payment or return.
Code lists
Section titled “Code lists”GET /reference/{kind} gives the codes our documents carry, so you can map them once. It needs
no scope.
kind |
Holds |
|---|---|
payment-methods |
What a payment’s method can be |
return-reasons |
What a return’s reason can be |
order-statuses, return-statuses, cheque-statuses |
Lifecycle states |
tax-codes |
VAT with the company’s rate |
currencies, units, warehouses, price-lists |
The company’s own rows, with your key beside ours |
rep |
One item per sales rep: code is the rep code (REP-06). attributes: van (the code of the rep’s van, or null) and active ("true" or "false"; inactive reps are listed too) |
van |
One item per van in use: code is the van code (VAN-06). attributes: warehouse (the van’s warehouse code, which is the van code), held_back_warehouse (its held-back place, VAN-06-Q, or null) and rep (the code of the rep it is assigned to, or null) |
Each item is {code, name: {en, ar}, id, external_ref, attributes}. For a rep, external_ref is
your key when one is mapped (or the worker id the rep was set up with); for a van it is the van
code, as in lookup. An attribute with no value is null.
GET /reference/van
curl -X GET 'https://api.slflo.com/api/integration/v1/reference/van' \ -H 'Authorization: Bearer $SLFLO_TOKEN'Response
HTTP 200
{ "data": [ { "code": "VAN-06", "name": {}, "id": "L-VAN-06", "external_ref": "VAN-06", "attributes": { "warehouse": "VAN-06", "held_back_warehouse": "VAN-06-Q", "rep": "REP-06" } } ], "meta": { "kind": "van", "count": 1 }}An unknown kind answers 404 with the valid kinds.
Try it
Section titled “Try it”curl -s "$SLFLO_BASE/lookup?entity=product&external_ref=JUICE-1L" -H "Authorization: Bearer $SLFLO_TOKEN" | jq -c .datacurl -s "$SLFLO_BASE/reference/payment-methods" -H "Authorization: Bearer $SLFLO_TOKEN" | jq -r '.data[].code'On a fresh sandbox the first answers the juice, found by its code, with "external_ref": null:
nobody has pushed JUICE-1L yet, and a PUT /products/JUICE-1L would adopt it. Once anyone has pushed it
it answers the same id with "external_ref": "JUICE-1L". The second lists CASH, CHEQUE,
TRANSFER, INSTAPAY and WALLET.

