Community

Community Forums

Where our customers, developers, and more can come together to help each other with both general and technical questions about our products and services.

ExpirationDate pass

Michele Dell'Acqua

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

 

Please sign in to leave a comment.

0
Avatar

Hi Michele,

I don't believe the API will allow you to create/update passes with an expiration date set in the past.

Additionally, remember that the expiration date is not a field on the pass, but rather a value assigned to the pass. So, the expiration date does not actually have or need a label value, since it's not shown to the user. 

For the list passes, yes, that is correct, you'll need to make the call to get the pass for each pass to return the expiration date.

 

Michael Halka 0 votes