Authentication
This page describes authenticating your subscription in order to use the API
The My Buggy My Car API uses Basic authentication and utilises your Subscription ID as a username equivalent and API Key as a password equivalent. The client should send an HTTP request with the Authorization header that contains the word Basic followed by a space and a base64-encoded string subscription_id:api_key. For example, to authorise as demo : p@55w0rd the client would send
Authorization: Basic ZGVtbzpwQDU1d29yZA==
If you're not familiar with generating a base64-encoded string, we can recommend the use of website https://www.base64encode.org.
The My Buggy My Car API requires the Authorization header is sent with all API requests to the server or a 403 error will be returned.
You must replace ZGVtbzpwQDU1d29yZA== with your personal Base64 encoded Subscription ID and API Key.
To authorise, you're welcome to use this sample code:
require_once 'HTTP/Request2.php';
$request = new HTTP_Request2();
$request->setUrl('https://api.mybuggymycar.com/API_ENDPOINT_HERE');
$request->setMethod(HTTP_Request2::METHOD_GET);
$request->setConfig(array(
'follow_redirects' => TRUE
));
$request->setHeader(array(
'Authorization' => 'Basic YOUR_BASE64_KEY'
));import http.client
conn = http.client.HTTPSConnection("api.mybuggymycar.com")
headers = { 'authorization': "Basic YOUR_BASE64_KEY" }
conn.request("GET", "API_ENDPOINT_HERE", headers=headers) you cpass the correct header curl --location --request GET 'API_ENDPOINT_HERE'
--header 'authorization: Basic YOUR_BASE64_KEY'var data = null;
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open("GET", "https://api.mybuggymycar.com/API_ENDPOINT_HERE");
xhr.setRequestHeader("authorization", "Basic YOUR_BASE64_KEY");
xhr.send(data);Make sure to replace
API_ENDPOINT_HEREwith the appropriate query andYOUR_BASE64_KEYwith your API key.
Last updated