Created
November 22, 2012 21:31
-
-
Save adrienbrault/4133000 to your computer and use it in GitHub Desktop.
symfony-hateoas-sandbox example usage with curl
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ curl -i -X GET "http://localhost:8000/" | |
HTTP/1.1 200 OK | |
Host: localhost:8000 | |
Connection: close | |
X-Powered-By: PHP/5.4.7 | |
cache-control: no-cache | |
content-type: application/vnd.fr.adrienbrault.hateoas+xml | |
x-debug-token: 50ae98a0c817e | |
<?xml version="1.0" encoding="UTF-8"?> | |
<result> | |
<link rel="tasks" href="http://localhost:8000/tasks"/> | |
<link rel="tasks/create" href="http://localhost:8000/tasks/forms/create"/> | |
</result> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ curl -i -X GET "http://localhost:8000/tasks" | |
HTTP/1.1 200 OK | |
Host: localhost:8000 | |
Connection: close | |
X-Powered-By: PHP/5.4.7 | |
cache-control: no-cache | |
content-type: application/vnd.fr.adrienbrault.hateoas+xml | |
x-debug-token: 50ae98a982b2f | |
<?xml version="1.0" encoding="UTF-8"?> | |
<collection page="1" limit="10" total="0"> | |
<form rel="pagination" method="GET" action="http://localhost:8000/tasks"> | |
<link rel="self" href="http://localhost:8000/tasks/forms/pagination"/> | |
<input type="hidden" value="1" name="pagination[page]" id="page"/> | |
<input type="hidden" value="10" name="pagination[limit]" id="limit"/> | |
</form> | |
<link rel="self" href="http://localhost:8000/tasks?pagination%5Blimit%5D=10&pagination%5Bpage%5D=1"/> | |
<link rel="first" href="http://localhost:8000/tasks?pagination%5Blimit%5D=10&pagination%5Bpage%5D=1"/> | |
<link rel="last" href="http://localhost:8000/tasks?pagination%5Blimit%5D=10&pagination%5Bpage%5D=0"/> | |
<link rel="pagination" href="http://localhost:8000/tasks/forms/pagination"/> | |
</collection> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ curl -i -X GET "http://localhost:8000/tasks/forms/create" | |
HTTP/1.1 200 OK | |
Host: localhost:8000 | |
Connection: close | |
X-Powered-By: PHP/5.4.7 | |
cache-control: no-cache | |
content-type: application/vnd.fr.adrienbrault.hateoas+xml | |
x-debug-token: 50ae98b711f3a | |
<?xml version="1.0" encoding="UTF-8"?> | |
<form method="POST" action="http://localhost:8000/tasks" rel="create"> | |
<link rel="self" href="http://localhost:8000/tasks/forms/create"/> | |
<input type="text" name="task[title]" required="required" maxlength="255" id="title"/> | |
<textarea name="task[description]" required="required" id="description"></textarea> | |
</form> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ curl -i -X POST -d "task[title]=Install FSCHateoasBundle&task[description]=You should, yep" "http://localhost:8000/tasks" | |
HTTP/1.1 201 Created | |
Host: localhost:8000 | |
Connection: close | |
X-Powered-By: PHP/5.4.7 | |
cache-control: no-cache | |
location: http://localhost:8000/tasks/1 | |
content-type: application/vnd.fr.adrienbrault.hateoas+xml | |
x-debug-token: 50ae990a980e2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ curl -i -X GET "http://localhost:8000/tasks/1" | |
HTTP/1.1 200 OK | |
Host: localhost:8000 | |
Connection: close | |
X-Powered-By: PHP/5.4.7 | |
cache-control: no-cache | |
content-type: application/vnd.fr.adrienbrault.hateoas+xml | |
x-debug-token: 50ae9917da0d0 | |
<?xml version="1.0" encoding="UTF-8"?> | |
<task> | |
<id>1</id> | |
<title><![CDATA[Install FSCHateoasBundle]]></title> | |
<description><![CDATA[You should, yep]]></description> | |
<isDone>false</isDone> | |
<link rel="self" href="http://localhost:8000/tasks/1"/> | |
<link rel="edit" href="http://localhost:8000/tasks/1/forms/edit"/> | |
<form rel="edit" method="PUT" action="http://localhost:8000/tasks/1"> | |
<link rel="self" href="http://localhost:8000/tasks/1/forms/edit"/> | |
<input type="text" value="Install FSCHateoasBundle" name="task[title]" required="required" maxlength="255" id="title"/> | |
<textarea name="task[description]" required="required" id="description">You should, yep</textarea> | |
<input type="checkbox" value="1" name="task[isDone]" required="required" id="isDone"/> | |
</form> | |
</task> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ curl -i -X PUT -d "task[title]=Install FSCHateoasBundle&task[description]=You should, yep&task[isDone]=1" "http://localhost:8000/tasks/1" | |
HTTP/1.1 302 Found | |
Host: localhost:8000 | |
Connection: close | |
X-Powered-By: PHP/5.4.7 | |
cache-control: no-cache | |
location: http://localhost:8000/tasks/1 | |
content-type: application/vnd.fr.adrienbrault.hateoas+xml | |
x-debug-token: 50ae994b4d7c7 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ curl -i -X GET "http://localhost:8000/tasks/1" | |
HTTP/1.1 200 OK | |
Host: localhost:8000 | |
Connection: close | |
X-Powered-By: PHP/5.4.7 | |
cache-control: no-cache | |
content-type: application/vnd.fr.adrienbrault.hateoas+xml | |
x-debug-token: 50ae9954d35a1 | |
<?xml version="1.0" encoding="UTF-8"?> | |
<task> | |
<id>1</id> | |
<title><![CDATA[Install FSCHateoasBundle]]></title> | |
<description><![CDATA[You should, yep]]></description> | |
<isDone>true</isDone> | |
<link rel="self" href="http://localhost:8000/tasks/1"/> | |
<link rel="edit" href="http://localhost:8000/tasks/1/forms/edit"/> | |
<form rel="edit" method="PUT" action="http://localhost:8000/tasks/1"> | |
<link rel="self" href="http://localhost:8000/tasks/1/forms/edit"/> | |
<input type="text" value="Install FSCHateoasBundle" name="task[title]" required="required" maxlength="255" id="title"/> | |
<textarea name="task[description]" required="required" id="description">You should, yep</textarea> | |
<input type="checkbox" value="1" checked="1" name="task[isDone]" required="required" id="isDone"/> | |
</form> | |
</task> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ curl -i -X GET "http://localhost:8000/tasks" | |
HTTP/1.1 200 OK | |
Host: localhost:8000 | |
Connection: close | |
X-Powered-By: PHP/5.4.7 | |
cache-control: no-cache | |
content-type: application/vnd.fr.adrienbrault.hateoas+xml | |
x-debug-token: 50ae995cb80a7 | |
<?xml version="1.0" encoding="UTF-8"?> | |
<collection page="1" limit="10" total="1"> | |
<form rel="pagination" method="GET" action="http://localhost:8000/tasks"> | |
<link rel="self" href="http://localhost:8000/tasks/forms/pagination"/> | |
<input type="hidden" value="1" name="pagination[page]" id="page"/> | |
<input type="hidden" value="10" name="pagination[limit]" id="limit"/> | |
</form> | |
<link rel="self" href="http://localhost:8000/tasks?pagination%5Blimit%5D=10&pagination%5Bpage%5D=1"/> | |
<link rel="first" href="http://localhost:8000/tasks?pagination%5Blimit%5D=10&pagination%5Bpage%5D=1"/> | |
<link rel="last" href="http://localhost:8000/tasks?pagination%5Blimit%5D=10&pagination%5Bpage%5D=1"/> | |
<link rel="pagination" href="http://localhost:8000/tasks/forms/pagination"/> | |
<task> | |
<id>1</id> | |
<title><![CDATA[Install FSCHateoasBundle]]></title> | |
<description><![CDATA[You should, yep]]></description> | |
<isDone>true</isDone> | |
<link rel="self" href="http://localhost:8000/tasks/1"/> | |
<link rel="edit" href="http://localhost:8000/tasks/1/forms/edit"/> | |
<form rel="edit" method="PUT" action="http://localhost:8000/tasks/1"> | |
<link rel="self" href="http://localhost:8000/tasks/1/forms/edit"/> | |
<input type="text" value="Install FSCHateoasBundle" name="task[title]" required="required" maxlength="255" id="title"/> | |
<textarea name="task[description]" required="required" id="description">You should, yep</textarea> | |
<input type="checkbox" value="1" checked="1" name="task[isDone]" required="required" id="isDone"/> | |
</form> | |
</task> | |
</collection> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment