Now I am in the step when device generate GET request to webServiceURL/version/devices/deviceLibraryIdentifier/registrations/passTypeIdentifier?passesUpdatedSince=tag
How the server send the serial of pass and also send last updated/tag; so I need to convert timestamp to string as lastUpdated is string? This is error from console:
Apr 5 13:45:24 CamMobs-iPod4 passd[21] <Warning>: Get serial #s task (for device b6511c0dd47d04da449ce427b27fea74, pass type pass.cam-mob.passbookpasstest, last updated (null); with web service url http://192.168.1.202:8888/passesWebserver/) encountered error: Server response was malformed (Missing response data)
Query your database and identify the serials (if any) that match deviceLibraryIdentifier
and passTypeIdentifier
and have changed since the passesUpdatedSince
tag. Hold these in an array.
Then send that array back to the device, or send a 204 response if there are no serials that need updating.
$serialsArray = array("abc123", "dec456"); // this array should be populated by your database.
if (!empty($serials)) {
echo json_encode(array('lastUpdated' => (string)time(),
'serialNumbers' => $serialsArray));
} else {
// No serials need updating so send a 204 response
}