試圖測試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);' –