can I implement this rest api call from a .bat file?

房东的猫 提交于 2019-12-11 14:09:10

问题


Can I implement this REST API call from a .bat file? This the request object:

public class ADEtlAction
{
    public string Type { get; set; }
    public string[] Domains { get; set; }
}

This is the what the REST call would look like:

POST api/v1/etl/actions { Type:"User" Domains:["ad-domain-1", "ad-domain-2"] }


回答1:


If you don't to use external binaries you can try with winhttpjs.bat:

call winhhtpjs.bat "http://server/api/v1/etl/actions"  -method POST   -header hdrs.txt -saveTo response.file   -body-file some.json

and in the some.json you'll need to put the body of the request and if you need some headers you can put them in the hdrs.txt file.



来源:https://stackoverflow.com/questions/49543357/can-i-implement-this-rest-api-call-from-a-bat-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!