我有一個用例,從存盤設備中獲取最后 5 分鐘的資料。當我在 python 中添加時,API 運行良好,但是在添加到 curl 時,它并沒有傳遞整個內容。
curl -X GET -H "X-EMC-REST-CLIENT: true" -H "Accept: application/json" -H "Content-type: application/json" -b cookies1.txt -L -k -u admin:xxxxxxx https://mystorageipaddress.com/api/types/event/instances?compact=true&fields=id,node,creationTime,severity,messageId,arguments,message,category,source,username&filter=creationTime GT "2022-11-02T10:35:09.927Z"
上面的 curl 只觸發到下面:
"https://mystorageipaddress.com/api/types/event/instances?per_page=2000&compact=true"
請建議
uj5u.com熱心網友回復:
您必須將具有特殊含義的字符轉義到shell,即
https://mystorageipaddress.com/api/types/event/instances\?compact=true\&fields=id,node,creationTime,severity,messageId,arguments,message,category,source,username\&filter=creationTime\ GT\ \"2022-11-02T10:35:09.927Z\"
但是,我懷疑 GT 前后的空格是否真的應該在 URL 中。你必須用 來代表它們 ,即類似的東西
https://mystorageipaddress.com/api/types/event/instances\?compact=true\&fields=id,node,creationTime,severity,messageId,arguments,message,category,source,username\&filter=creationTime GT \"2022-11-02T10:35:09.927Z\"
當然,如果您愿意,也可以在字串周圍使用單引號而不是反斜杠來進行轉義。
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/525521.html
標籤:壳卷曲卷曲命令行
