怎么让guzzle发送没有名字的参数?

时间:2013-07-09 06:41:25

标签: php json rest guzzle

我有这样的操作说明:

    "AddContact": {
        "httpMethod": "POST",
        "uri": "icp/a/{account_id}/c/{folder_id}/contacts",
        "summary": "Adds a contact.",
        "responseClass": "IM\\MailingList\\IContact\\Response\\Contact",
        "parameters": {
            "account_id": {
                "location": "uri",
                "required": true
            },
            "folder_id": {
                "location": "uri",
                "required": true
            },
            "contacts": {
                "location": "json",
                "required": true
            }
        }
    }

以下是guzzle发送的内容:

{"contacts":[{"email":"email@test.tld","firstName":"firstName","lastName":"lastName"}]}

我真正需要的是:

[{"email":"email@test.tld","firstName":"firstName","lastName":"lastName"}]

怎么做?

1 个答案:

答案 0 :(得分:0)

我唯一需要做的就是将location参数更改为body