在其实况的fastbill API状态,使这个卷曲的请求,以接收信息:卷曲请求
curl -v -X POST \
–u {E-Mail-Adresse}:{API-Key} \
-H 'Content-Type: application/xml' \
-d '{xml body}' \
https://my.fastbill.com/api/1.0/api.php
使用RestClient
我试着翻译成像要求一个Ruby这样的:
我如何阅读: - 使用基本身份验证并在头中声明内容类型,向https://my.fastbill.com/api/1.0/api.php发出发布请求,是否正确?
现在,这将是RestClient
这样的资源基础的要求:
首先,我验证:
resource = RestClient::Resource.new('https://my.fastbill.com/api/1.0/api.php', '[email protected]', 'API-KEY-XXXXX')
其工作,并授权我。 然后把我的请求:
xml = '<?xml version="1.0" encoding="utf-8"?><FBAPI><SERVICE>customer.get</SERVICE><FILTER/></FBAPI>'
resource.post xml, content_type: 'application/xml'
它总是返回400,我不知道还能在这里做什么。
另外json如何在这里工作?
resource.post param1: 'value', content_type: 'json'
会很明显。
庵的详细列表...这是红宝石? – Pang
为什么?你为什么要这么做? – Hamdan