I was wanting some help please to create a snippet of cURL to call an API.
Any assistance would be greatly appreciated.
This is the API Call
POST https://api.passes.com/v1/templates/names/Member%20Card/pass
apparently they need the following sent
------------------------------330184f75e21
Content-Disposition: form-data; name="values"; filename="values.json"
Content-Type: application/json
{
"firstName": "John",
"lastName": "Doe",
}
------------------------------330184f75e21
Content-Disposition: form-data; name="icon"; filename="icon.png"
Content-Type: application/octet-stream
imagedata
------------------------------330184f75e21
Content-Disposition: form-data; name="icon@2x"; filename="[email protected]"
Content-Type: application/octet-stream
imagedata
I am not sure what to place in the cURL at all.
I have tried the following without success.
$url1 = 'https://api.passes.com/v1/templates/names/Test/pass';
$data1 = array("values" => '{"first":"John","last":"Doe"}','application/json',
"strip" => '@../uploads/icon.png','application/octet-string','icon.png',
"strip@2x" => '@../uploads/icon.png','application/octet-string','icon.png');
$auth1 = array( "authorization: Basic xxxxxxxxxxxx=", "cache-control: no-cache", "postman-token: xxxxxxxxx");
$ch1 = curl_init($url1);
curl_setopt($ch1, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch1, CURLOPT_POST, 1);
curl_setopt($ch1, CURLOPT_POSTFIELDS, $data1);
curl_setopt($ch1, CURLOPT_HEADER, 0);
curl_setopt($ch1, CURLOPT_HTTPHEADER, $auth1);
$response1 = curl_exec($ch1);
echo $response1;
It replies with a response saying invalid JSON
If anyone can help that would be great.
Thanks
Rob