完整的设备绑定通知休息对我不起作用 [英] Complete Device Bound Notification rest does not work for me
问题描述
大家好,
     我用php-curl调用REST调用来完成从
引用的设备通知消息
官方文档。以下是我的代码
<?php
$ curl = curl_init();
curl_setopt_array($ curl,array(
CURLOPT_URL =>" https://MYHUBNAME.azure-devices.net/devices/MYDVCID/messages/deviceBound/DVCTAG? api-version = 2018-06-30",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING =>"",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST =>" DELETE",
CURLOPT_POSTFIELDS =>"",
CURLOPT_HTTPHEADER => array(
"接受:application / json",
"授权:MYSASTOKEN",&
"Cache-Control:no-cache",
" Connection:keep-alive",$
" Host:MYHUB HOST",
&NBSP; "UserAgent:Microsoft.Azure.Devices / 1.17.2",
&NBSP; " accept-encoding:gzip,deflate",
&NBSP; "cache-control:no-cache",
&NBSP; "content-length:"&
),$
));
$
$ response = curl_exec($ curl);
$ err = curl_error ($ curl);
curl_close($ curl);
$
if($ err){
echo"cURL错误#:" 。 $ err;
}否则{
echo $ response;
}
$
在回复中我总是得到以下json回复
{
"消息":" {" errorCode":400004," trackingId":" XXXXXXXXX-G:7-TimeStamp:XXXXXXXX"," message":" BadRequest"," timestampUtc":" XXXXXXXXX"}",
"ExceptionMessage":""
}
我尝试了很多但没有解决问题,请帮助我
Hi all,
I am calling REST call with php-curl to complete the device notification message referred from
official doc. below is my code
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://MYHUBNAME.azure-devices.net/devices/MYDVCID/messages/deviceBound/DVCTAG?api-version=2018-06-30",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_POSTFIELDS => "",
CURLOPT_HTTPHEADER => array(
"Accept: application/json",
"Authorization: MYSASTOKEN",
"Cache-Control: no-cache",
"Connection: keep-alive",
"Host: MYHUBHOST",
"UserAgent: Microsoft.Azure.Devices/1.17.2",
"accept-encoding: gzip, deflate",
"cache-control: no-cache",
"content-length: "
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
In the response i am always getting the below json response
{
"Message": "{"errorCode":400004,"trackingId":"XXXXXXXXX-G:7-TimeStamp:XXXXXXXX","message":"BadRequest","timestampUtc":"XXXXXXXXX"}",
"ExceptionMessage": ""
}
I tried alot to fix it but not getting the issue, please help me
推荐答案
Hi Vishal,
Hi Vishal,
我们需要查看服务器端日志。
We will need to take a look at server side logs.
您能否提交支持请求@ https://aka.ms/azsupt并参考此问题说明?如果您无法访问支持计划,请联系@ AZCommunity @ microsoft.com,并提供此Doc / Issue的链接以及您的订阅
ID,我们可以帮助您获取此问题的支持服务单。
Can you please file a support request @ https://aka.ms/azsupt and reference this issue in the description? If you do not have access to a support plan, please reach out @ AZCommunity @ microsoft.com with a link to this Doc/Issue as well as your subscription ID and we can help get the support ticket opened for this issue.
谢谢!
这篇关于完整的设备绑定通知休息对我不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!