Each API request must be authenticated using your email and API key. You have three options for including authentication data with your requests:
--user
ParameterThis is the recommended method and is used in all the examples:
curl --user admin@example.com:APIkey -X GET 'https://www.venddor.com.br/api/users/'
You can pass the credentials directly in the URL:
curl --basic -X GET 'http://admin%40example.com:APIkey@example.com/api/users/'
@
character in email addresses must be URL-encoded as %40
.
You can include authentication in the request header:
curl --header 'Authorization: Basic <base64-encoded email:APIkey pair>' -X GET 'https://www.venddor.com.br/api/users/'
The email:APIkey
pair must be encoded in base64.
$token = base64_encode("admin@example.com:your_api_key_here"); $authHeaderString = 'Authorization: Basic ' . $token; // Example of using with cURL $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, 'https://www.venddor.com.br/api/users/'); curl_setopt($curl, CURLOPT_HTTPHEADER, [$authHeaderString]); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); $response = curl_exec($curl);