在其實況的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