我需要在这样的curl请求中应用OData过滤器
curl -k -H "Authorization: Bearer d_fkI7fEPSz9z8RmaGklFWeuPp4a" -v 'https://api.smartdatanet.it/api/Deploy_confi_3790/DataEntities?&$format=json&$top=15&$filter=Ide_id eq 2071)'
服务以这种形式的Json格式响应
"internalId": "5c50c7e97f3a377c2431e8cf",
"datasetVersion": 1,
"idDataset": "3790",
"Id_unita_install": 52709,
"Progressivo": "2",
"Tipo_udd": "Unità di config",
"Id_istanza": 1347,
"Id_middleware": 4,
"Middleware": "Apache WebServer",
"Vers_middleware": "2.2.31",
"Ambiente": "COLL",
"Partizione": null,
"Dominio": null,
"Valore": "naocli/naocli8",
"Ide_id": 2071
...因此Ide_id字段存在并且内部有数字。
当我尝试执行该错误时:
{"error":{"code":null,"message":{"lang":"en","value":"Invalid filter expression: 'Ide_id'."}}}
任何建议都值得赞赏!
答案 0 :(得分:0)
我解决了!我的原始curl请求中有两个错误,一个是sintax错误(请求末尾是“。” ....),还有一些在过滤器中不对“空格”使用转义的麻烦。
正确的请求是紧随其后的
curl -k -H "Authorization: Bearer d_fkI7fEPSz9z8RmaGklFWeuPp4a" -v 'https://api.smartdatanet.it/api/Deploy_confi_3790/DataEntities?&$format=json&$top=15&$filter=Ide_id%20eq%202290'