试图测试Uber Rush API(从本地主机和从Linux服务器)。Uber Rush API Sandbox
呼叫标记的工作 - 我得到的令牌 试图实现的SANbox例如:
curl -X "PUT /v1/sandbox/deliveries/{delivery_id}" \
-H "Authorization: Bearer <OAUTH TOKEN>" \
-d "{\"status\":\"en_route_to_pickup\"}"
与URL https://sandbox-api.uber.com/
,我试着用的file_get_contents(在PHP)
所以相同的请求,我总是得到错误“405方法不允许”
{"message":"Method not supported for this endpoint.","code":"method_not_allowed"}
我需要做什么才能从此沙盒示例https://developer.uber.com/docs/rush/sandbox访问方法?
Corrent语法
curl -X "PUT" -H "Authorization: Bearer <TOKEN>" -H "Content-Type: application/json" -d "{\"status\":\"en_route_to_pickup\"}" https://sandbox-api.uber.com/v1/sandbox/deliveries/DELIVERY_ID
你正在做什么确切的调用file_get_contents? –
'$ url ='https://sandbox-api.uber.com/v1/sandbox/deliveries/ID_HERE'; $ headers = array('Authorization:Bearer'.TOKEN_HERE); $ options = array( 'https'=> array( 'header'=> $ headers, ), ); $ context = stream_context_create($ options); $ result = file_get_contents($ url,false,$ context);' –