现在我正处于设备向webServiceURL/version/devices/deviceLibraryIdentifier/registrations/passTypeIdentifier?passesUpdatedSince=tag
服务器如何发送传递序列并发送最后更新的/ tag;所以我需要将时间戳转换为字符串,因为lastUpdated是字符串?这是来自控制台的错误:
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)
答案 0 :(得分:1)
查询您的数据库并识别与deviceLibraryIdentifier
和passTypeIdentifier
匹配且自passesUpdatedSince
标记以来发生更改的序列号(如果有)。把它们放在一个数组中。
然后将该阵列发送回设备,如果没有需要更新的序列号,则发送204响应。
$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
}