0

你如何将 curl -d "65" 翻译成 java httpput 条目?我需要使用 java apache http 库在这个指向 java 的链接中执行 curl 命令。

获取和更改 Nest 恒温器的基本数据

这是卷曲命令:

curl -v -L -X PUT " https://developer-api.nest.com/devices/thermostats/THERMOSTAT_ID/target_temperature_f?auth=AUTH_CODE " -H "Content-Type: application/json" -d "65"

这是我的java代码:

httpPut.setHeader("Content-Type", "application/json");     
HttpEntity put_entity =  new StringEntity("65"); // Problem is here, I think!
httpPut.setEntity(put_entity);           // or here!
HttpResponse put_response = httpclient.execute(httpPut);
4

0 回答 0