According to the documentation on: Create an export request for an existing skill
POST /v1/skills/{skillId}/stages/{stage}/exports
But the docs don't say what the POST request body
should be, so I've tried not sending a body, and tried sending an empty JSON object. Same results.
I'm using cURL with PHP to send a POST request to the full url:
$url = "https://api.amazonalexa.com/v1/skills/$skillId/stages/$stage/exports";
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Authorization: '.$access_token));
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_HTTP_VERSION, 'CURLOPT_HTTP_VERSION_NONE');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS,json_encode(array()));
//enable and get headers, this API response has no body, only headers
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_NOBODY, 1);
$result = curl_exec($ch);
curl_close($ch);
But I receive this error response status:
HTTP/1.1 405 Method Not Allowed
I know that the skillId
and stage
variables are correct because I am able to send POST requests to the other API methods in a similar way without error. (ei. Update Skill Manifest)
I have tried double checking all of the permissions set through Amazon Login, and I am using all of the ones shown in the docs:
alexa::ask:skills:read alexa::ask:skills:readwrite alexa::ask:models:read alexa::ask:models:readwrite alexa::ask:skills:test
Why is it still returning a 405 error?
Using CURLOPT_NOBODY changes the request method to HEAD rather than POST, so try removing that line.