تخطَّ إلى المحتوى

Lookup and code lists

هذا المحتوى غير متوفر بلغتك بعد.

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
}
}
  • entity is customer, branch, product, unit, price_list, warehouse, order, invoice, payment (or receipt), return (or credit_note).
  • Send external_ref (yours) or id (ours), not both.
  • 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:write for a product or unit, prices:write for a price list, catalog:write or a stock scope for a warehouse, and the read or write scope for an order, invoice, payment or return.

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

Each item is {code, name: {en, ar}, id, external_ref, attributes}. An unknown kind answers 404 with the valid kinds.

Terminal window
curl -s "$SLFLO_BASE/lookup?entity=product&external_ref=JUICE-1L" -H "Authorization: Bearer $SLFLO_TOKEN" | jq -c .data
curl -s "$SLFLO_BASE/reference/payment-methods" -H "Authorization: Bearer $SLFLO_TOKEN" | jq -r '.data[].code'

Lookup by external_ref finds only keys an ERP has pushed or acked, not Slflo’s own codes. So on a fresh sandbox the first answers "exists": false; after anyone pushes PUT /products/JUICE-1L (which adopts the juice, whose code is the same) it answers with the product’s id. The second lists CASH, CHEQUE, TRANSFER, INSTAPAY and WALLET.