guzzle-bundle icon indicating copy to clipboard operation
guzzle-bundle copied to clipboard

Documentation issue.

Open jaznow opened this issue 11 years ago • 1 comments

Hi,

Just wanted to point out, that in your documentation: https://github.com/misd-service-development/guzzle-bundle/blob/master/Resources/doc/serialization.md

You explain how you can define commands, and you say that you can put: "GetPerson":{ "httpMethod":"GET", "uri":"person/{id}",...

and so on.

But I couln't figure out, where should I put that on, and re-readed, and re-readed the documentacion, and still couldnt figure out, I've even asked on a IRC channel, but couldn't get any help.

It would be awesome that I could have this working, but can't follow the doc on this part (de serialization)

Thanks!

jaznow avatar Jul 10 '14 16:07 jaznow

Have you read the part on service description ? https://github.com/misd-service-development/guzzle-bundle/blob/master/Resources/doc/service.md

You must set a new service which is a bridge beetween Guzzle and a configuration file. Then you describe your WS in this file.

I use this definition on a project :

my_api.client:
        class: %guzzle.client.class%
        tags:
            - { name: guzzle.client }
        calls:
            - [ setBaseUrl,     [ %my_api.client.base_url% ] ]
            - [ setDescription, [ @my_api.service_description ] ]

    my_api.service_description:
        class: %guzzle.service_description.class%
        factory_class: %guzzle.service_description.class%
        factory_method: factory
        arguments: [ %my_api.client.service_description_path% ]

and my service description is something like this :

{
    "name": "MyAPI",
    "description": "MyAPI client",
    "operations": {
        "getPersons": {
            "httpMethod": "GET",
            "uri": "/api/persons.json",
            "additionalParameters": {
                "location": "query"
            },
            "responseClass":"ArrayCollection<Entity\\Person>"
        }
    }
}

alex-pex avatar Dec 02 '14 16:12 alex-pex