我可以从.bat文件实现此rest api调用吗? [英] can I implement this rest api call from a .bat file?

查看:497
本文介绍了我可以从.bat文件实现此rest api调用吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以从.bat文件实现此REST API调用吗?这个请求对象:

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; }
}

这是REST调用的样子:

This is the what the REST call would look like:

POST api/v1/etl/actions { 类型:用户" 域:["ad-domain-1","ad-domain-2"] }

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

推荐答案

如果您不使用外部二进制文件,则可以尝试使用

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

some.json中,您需要放入请求的正文,如果需要一些标头,则可以将它们放在hdrs.txt文件中.

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.

这篇关于我可以从.bat文件实现此rest api调用吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆