Base URL
http://localhost:5000
Primary resource - The courtcase object
{
"type": "courtcase",
"id": 1,
"attributes": {
"plaintiff": "John Doe, an individual",
"defendant": "Jane Doe, an individual, and DOES 1-10, inclusive."
}
}
Endpoints and available request methods
Jump to section
Retrieve all stored court cases
# Request
curl -i http://localhost:5000/api/cases
# Response
HTTP/1.0 200 OK
Content-Type: application/json
[
{
"type": "courtcase",
"id": 1,
"attributes": {
"plaintiff": "Plaintiff's name",
"defendant": "Defendant's name"
}
},
{
"type": "courtcase",
"id": 2,
"attributes": {
"plaintiff": "Another plaintiff's name",
"defendant": "Another defendant's name"
}
},
{
"type": "courtcase",
"id": 3,
"attributes": {
"plaintiff": "Yet another plaintiff's name",
"defendant": "Yet another defendant's name"
}
}
]
Status code summary:
200 - OK | Worked as expected.
Submit a new court case
# Request
curl -X POST \
-F file=@{someXMLfile}.xml \
http://localhost:5000/api/cases
# Response
HTTP/1.0 201 CREATED
Content-Type: application/json
{
"type": "courtcase",
"id": 1,
"attributes": {
"plaintiff": "Plaintiff's name",
"defendant": "Defendant's name"
}
}
Status code summary:
201 - CREATED | New case was created.
400 - BAD REQUEST | Server was unable to parse the xml.
Retrieve single stored court case
# Request
curl -i http://localhost:5000/api/cases/15
(or any other case id available in the database)
# Response
HTTP/1.0 200 OK
Content-Type: application/json
{
"type": "courtcase",
"id": 15,
"attributes": {
"plaintiff": "Plaintiff's name",
"defendant": "Defendant's name"
}
}
OR
HTTP/1.0 404 NOT FOUND
Content-Type: application/json
{
"message": "Case not found."
}
Status code summary:
200 - OK | Worked as expected.
404 - NOT FOUND | Id was not found in database.