How a call passes the gateway
What the gateway checks on every call to a product, what it answers when a check fails, and what it does before the call reaches the provider.
Read this page in العربية
In short#
Every call to a product goes to a gateway address, never straight to the provider's service. The gateway checks the call, and a call that fails a check is answered by the gateway itself and never reaches the provider. A call that passes is shaped for the provider's service and sent to it, and the provider's answer comes back to you with the gateway's own headers added, such as X-API360-Request-Id.
| Environment | Gateway address |
|---|---|
| Production | gate.api360.sa |
| Sandbox | gate-test.api360.sa |
Both addresses answer HTTPS only.
What the gateway checks#
| Check | What passes | What a failing call gets |
|---|---|---|
| The route | The product slug, /v and the version, the path and the method match a published endpoint | 404 with route_not_found |
| The credential | An app key in the api360key header, or the app's HTTP Basic username and password | 401 with api_key_missing or api_key_invalid |
| The subscription | The app holds an active subscription to the product, in the environment of the address | 403 with subscription_required, or a code that names the subscription's state |
| The quota | The subscription, and on products priced per endpoint the endpoint, still has requests left | 403 (the subscription) or 429 (the endpoint) with quota_exceeded |
| The rate limit | Only the provider's own Default App (Testing), in Sandbox: 100 requests a day on each product it publishes | 429 with rate_limit_exceeded |
The gateway's own answers carry a JSON object error with a code, a message in Arabic or English, a request_id and a docs_url. Every answer, the gateway's and the provider's, carries an X-API360-Request-Id header. The full list of codes and what to do about each is in errors, status codes and retries.
What the gateway does before the provider#
- It sets the path and the headers of the request the way the provider's service expects them for that endpoint. The address you call stays the same.
- It counts the call against your quota and records it (logs and analytics).