Skip to content

Instantly share code, notes, and snippets.

@artgon
Created July 14, 2012 17:08
Show Gist options
  • Save artgon/3112158 to your computer and use it in GitHub Desktop.
Save artgon/3112158 to your computer and use it in GitHub Desktop.
api test
art-macbook:matygo artg$ time curl -v localhost:8081/courses -H "Content-Type: application/json" -H "Accept: application/json" -X POST -d '{"title":"a","description":"2","subject":"","organizationId":1}' -b cookies.txt
* About to connect() to localhost port 8081 (#0)
* Trying ::1... connected
* Connected to localhost (::1) port 8081 (#0)
> POST /courses HTTP/1.1
> User-Agent: curl/7.21.4 (universal-apple-darwin11.0) libcurl/7.21.4 OpenSSL/0.9.8r zlib/1.2.5
> Host: localhost:8081
> Cookie: MatygoSession=Oixh2Gnrj6E95L497o9ZMw00A6DDMK0YjXCxCSv6RubXQw6SGTV0BYibww4cEmzh
> Content-Type: application/json
> Accept: application/json
> Content-Length: 63
>
< HTTP/1.1 422 Unprocessable Entity
< Content-Type: application/json;charset=UTF-8
< Content-Length: 733
< Connection: persist
< Server: Jetty(8.1.3.v20120416)
<
* Connection #0 to host localhost left intact
* Closing connection #0
{"subject":"","description":"2","title":"a","organizationId":1,"id":0,"createdOn":"2012-07-14T10:05:36-0700","updatedOn":"2012-07-14T10:05:36-0700","errors":{"isValid":false,"results":[{"isValid":false,"fieldName":"title","message":"title must be at least 4 characters long"},{"isValid":false,"fieldName":"description","message":"description must be at least 4 characters long"},{"isValid":false,"fieldName":"subject","message":"subject must be at least 4 characters long"}]},"validators":[{"fieldName":"subject","type":"StringLengthValidator","min":4,"max":2147483647},{"fieldName":"description","type":"StringLengthValidator","min":4,"max":2147483647},{"fieldName":"title","type":"StringLengthValidator","min":4,"max":2147483647}]}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment