问题
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