Make authenticated requests
An app can make authenticated requests to the Zencargo API using basic authentication, supplying a valid API key.
Basic Authentication
Zencargo uses Basic Authentication to authenticate calls to its public API.
- Use your API key's ID as the username
- Use your API key's secret as the password
You can generate these credentials in the Zencargo App
Settings > API Keyssection
Authenticating calls using basic authentication requires for you to provide these credentials in the Authorization header field as follows:
- Join the API Key ID and secret with a single colon (
:). - Encode the resulting string in base64 representation.
- Prepend the base64-encoded string with Basic and a space:
Authorization: Basic ODAxZGQzNzUtYTdlZS00NzQwLWE3OGYtMzdiM2ZjYWQ2MjFiOjI3Yks3UlMxQ21uZVhRY3g1YnBx
Hint: If you're on a Unix-like OS you can encode your key and secret with:
echo -n 'YOUR_API_ID:YOUR_API_SECRET' | base64
Here's an example request using the API Key we've generated and the API staging URL we were provided:
curl -X POST \
https://zawesomedev.api.staging.zencargo.com/graphql \
-H 'Content-Type: application/json' \
-H 'Authorization: Basic ODAxZGQzNzUtYTdlZS00NzQwLWE3OGYtMzdiM2ZjYWQ2MjFiOjI3Yks3UlMxQ21uZVhRY3g1YnBx' \
-d ' { "query": "query { products { nodes { name skuCode } } }" }'
**You can ignore the data (
-d) part for now, it is documented in details later when we send our first API call