How to use Guzzle with HATEOAS

186 views
Skip to first unread message

Grégoire Pineau

unread,
Mar 30, 2013, 3:07:17 PM3/30/13
to guz...@googlegroups.com
Hello.

I used this lib (https://github.com/willdurand/Hateoas) to generate my WS. And now I'm builing the SDK with guzzle.

And I don't know how to build my config.json.
I have try lot of configuration, but nothing really work. Can anyone help me ?

You can see in this gist https://gist.github.com/lyrixx/750a81b14386c033a316 my "best" config.json and
a sample of what my web service can produce.

for now, Guzzle can not map correctly my "object".

Thanks to take time to help me.

Johann Brocail

unread,
May 20, 2014, 5:37:25 AM5/20/14
to guz...@googlegroups.com
Hi all,

i search a php client for RESTful API with HATEOAS "feature". i turned to guzzle but i didn't see the HEATEOAS "feature". Do you have find something ?

Thx a lot for reply

Michael

unread,
Jun 1, 2014, 3:20:20 PM6/1/14
to guz...@googlegroups.com
Guzzle is only an HTTP client. There are abstractions built on top of Guzzle that make it easy to consume REST webservices (https://github.com/guzzle/guzzle-services), but nothing to support HATEOAS yet. If there were such a thing, what would you envision it to look like?

Johann Brocail

unread,
Jun 2, 2014, 10:50:01 AM6/2/14
to guz...@googlegroups.com
Hi michael,

thx for reply,

guzzle-service is interesting, but it will be better if we can combine many request per operation with conditional transition

example :
$description = new Description([
    'baseUrl' => 'http://httpbin.org/',
    'operations' => [
        'testing' => [
            'httpMethod' => 'GET',
            'uri' => '/get',
            'responseModel' => 'getResponse',
            'parameters' => [
                'foo' => [
                    'type' => 'string',
                    'location' => 'query'
                ]
            ]
        ]
    ],
    'models' => [
        'getResponse' => [
            'type' => 'object',
            'additionalProperties' => [
                'location' => 'json'
            ]
        ]
    ]
]);

become :

$description = new Description([ 'baseUrl' => 'http://httpbin.org/', 'operations' => [ 'testing' => [
  [
'httpMethod' => 'GET', 'uri' => '/get', 'responseModel' => 'getResponse', 'parameters' => [ 'foo' => [ 'type' => 'string', 'location' => 'query' ] ]
],
[
'httpMethod' => 'GET', 'uri' => '/get', 'responseModel' => 'getResponse', 'parameters' => [ 'foo' => [ 'type' => 'string', 'location' => 'query' ] ]
]
  ] ], 'models' => [ 'getResponse' => [ 'type' => 'object', 'additionalProperties' => [ 'location' => 'json' ] ] ] ]);


Le samedi 30 mars 2013 20:07:17 UTC+1, Grégoire Pineau a écrit :
Reply all
Reply to author
Forward
0 new messages