Hi,
I have a problem with updating the pass expirationdate
This is my function
public function getPassFire($id){
$login = 'xxxx';
$password = 'xxxx';
$url = 'https://wallet-api.urbanairship.com/v1/pass/' . $id;
$datapass=array("expirationDate"=>array("label"=>"voided"));
$data = array("headers" => $datapass);
$data_string = json_encode($data);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json','Content-Length: ' . strlen($data_string)));
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_USERPWD, "$login:$password");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
$result = curl_exec($ch);
curl_close($ch);
return redirect()->route('viewpass');
}
Everything works, pass updated date changes, does not return any error.
But when i call a getpass this is a part of response
"expirationDate":{ "changeMessage":null, "label":"", "hideEmpty":false, "formatType":"String", "value":"2017-07-20T11:26:00Z", "fieldType":"topLevel", "required":false }
Label not appears. The same thing if instead of updating the label, change the value like:
$datapass=array("expirationDate"=>array("value"=>"2017-06-20T11:26:00Z"));
In this case the value does not change, only pass updated date changes.
Why?
One last things: With the request "list passes" i can not know which passes have expired. I have to make the call "get pass" for each passes returned, right? Wasn't It better to return the expirationdate to the "list passes" too?
Many thanks
Comments
1 comment