Let’s say that you are trying to get a list of all the CSPs configured for your site with the identifier “demosports” (there is a separate FAQ regarding how to find your site identifier) and you try sending this request:
curl -X POST \
'https://api.bluetriangletech.com/content-security-policies?prefix=demosports' \
-H 'X-API-Email:artificial_user@bluetriangle.com' \
-H 'X-API-Key: 4598b7a1dd50023bedd44c83c792d051'
*Please note, you will need to replace the X-API-Email and X-API-Key headers with your own. There is also a separate FAQ regarding how to find your API email and key.
The API will respond with a “Method not allowed” message that looks like this:
{
"status": 0,
"error_code": 400,
"message": "Method not allowed"
}
In this case, the API is referring to the HTTP method used in the request. The Blue Triangle API typically uses either the GET or POST method, and the allowed HTTP methods are listed in the documentation page for each endpoint (https://help-uji.aternity.com/hc/en-us/sections/13508532300563-API). Looking at the documentation for the CSP endpoint, we can see that the Endpoint is listed as “GET /content-security-policies?prefix=[:prefix]”. This means that this API endpoint is expecting the GET method, so the request should be modified to:
curl -X GET \
'https://api.bluetriangletech.com/content-security-policies?prefix=demosports' \
-H 'X-API-Email:artificial_user@bluetriangle.com' \
-H 'X-API-Key: 4598b7a1dd50023bedd44c83c792d051'
*Please note that the answer will not always be changing the method from POST to GET. Some endpoints will require you to change the method from GET to POST instead. Please refer to the documentation for the endpoint you are using.