Dox Example


This api is implemented according to the JSON API spec.

Filter

If you want to filter your query, you can do so by setting the supported filter parameters in the following way:

  • ?author_id=24
Authors

Authors group

Authors

Get authors

REQUEST returns a list of authors

GET  /api/v1/authors

Headers
Accept application/vnd.api+json
Content-Type application/vnd.api+json

RESPONSE

Headers
Content-Type application/vnd.api+json; charset=utf-8
200 application/vnd.api+json; charset=utf-8
                        {
  "data": [
    {
      "id": "1",
      "type": "authors",
      "attributes": {
        "name": "Author_1"
      },
      "relationships": {
        "books": {
          "meta": {
            "included": false
          }
        }
      }
    }
  ]
}

                      
                        
                      

Get an author

REQUEST returns an author

GET  /api/v1/authors/1

Parameters
id string 1 -
Headers
Accept application/vnd.api+json
Content-Type application/vnd.api+json

RESPONSE

Headers
Content-Type application/vnd.api+json; charset=utf-8
200 application/vnd.api+json; charset=utf-8
                        {
  "data": {
    "id": "1",
    "type": "authors",
    "attributes": {
      "name": "Author_2"
    },
    "relationships": {
      "books": {
        "data": [

        ]
      }
    }
  }
}

                      
                        
                      

REQUEST does not find an author

GET  /api/v1/authors/invalid_id

Parameters
id string 1 -
Headers
Accept application/vnd.api+json
Content-Type application/vnd.api+json

RESPONSE

Headers
Content-Type application/vnd.api+json; charset=utf-8
404 application/vnd.api+json; charset=utf-8
                        {
  "errors": [

  ]
}

                      
                        
                      

Create an author

REQUEST creates a new Author

POST  /api/v1/authors

Headers
Accept application/vnd.api+json
Content-Type application/vnd.api+json
application/vnd.api+json
                          {
  "data": {
    "type": "author",
    "attributes": {
      "name": "Author_5"
    }
  }
}

                        
                          
                        

RESPONSE

Headers
Content-Type application/vnd.api+json; charset=utf-8
201 application/vnd.api+json; charset=utf-8
                        {
  "data": {
    "id": "2",
    "type": "authors",
    "attributes": {
      "name": "Author_5"
    },
    "relationships": {
      "books": {
        "meta": {
          "included": false
        }
      }
    }
  }
}

                      
                        
                      

REQUEST returns unprocessable entity

POST  /api/v1/authors

Headers
Accept application/vnd.api+json
Content-Type application/vnd.api+json
application/vnd.api+json
                          {
  "data": {
    "type": "author",
    "attributes": {
      "name": ""
    }
  }
}

                        
                          
                        

RESPONSE

Headers
Content-Type application/vnd.api+json; charset=utf-8
422 application/vnd.api+json; charset=utf-8
                        {
  "errors": [
    {
      "title": "Unprocessable Entity",
      "detail": "Name can't be blank",
      "source": {
        "parameter": "name",
        "pointer": "data/attributes/name"
      }
    }
  ]
}

                      
                        
                      

Update an author

REQUEST updates the requested author

PUT  /api/v1/authors/1

Parameters
id string 1 -
Headers
Accept application/vnd.api+json
Content-Type application/vnd.api+json
application/vnd.api+json
                          {
  "data": {
    "type": "author",
    "id": 1,
    "attributes": {
      "name": "New Author"
    }
  }
}

                        
                          
                        

RESPONSE

Headers
Content-Type application/vnd.api+json; charset=utf-8
200 application/vnd.api+json; charset=utf-8
                        {
  "data": {
    "id": "1",
    "type": "authors",
    "attributes": {
      "name": "New Author"
    },
    "relationships": {
      "books": {
        "meta": {
          "included": false
        }
      }
    }
  }
}

                      
                        
                      

REQUEST returns unprocessable entity

PUT  /api/v1/authors/1

Parameters
id string 1 -
Headers
Accept application/vnd.api+json
Content-Type application/vnd.api+json
application/vnd.api+json
                          {
  "data": {
    "type": "author",
    "id": 1,
    "attributes": {
      "name": ""
    }
  }
}

                        
                          
                        

RESPONSE

Headers
Content-Type application/vnd.api+json; charset=utf-8
422 application/vnd.api+json; charset=utf-8
                        {
  "errors": [
    {
      "title": "Unprocessable Entity",
      "detail": "Name can't be blank",
      "source": {
        "parameter": "name",
        "pointer": "data/attributes/name"
      }
    }
  ]
}

                      
                        
                      

Delete an author

REQUEST deletes the requested author

DELETE  /api/v1/authors/1

Parameters
id string 1 -
Headers
Accept application/vnd.api+json
Content-Type application/vnd.api+json

RESPONSE

Headers
Books
Book Collections

Get book collections

REQUEST returns book collections

GET  /api/v1/book_collections

Headers
Accept application/vnd.api+json
Content-Type application/vnd.api+json

RESPONSE

Headers
Content-Type application/vnd.api+json; charset=utf-8
200 application/vnd.api+json; charset=utf-8
                        {
  "data": [
    {
      "id": "1",
      "type": "book_collections",
      "attributes": {
        "name": "Book_collection_1"
      },
      "relationships": {
        "books": {
          "meta": {
            "included": false
          }
        }
      }
    }
  ]
}

                      
                        
                      

Get a book collection

REQUEST returns a book collection

GET  /api/v1/book_collections/1

Parameters
id string 1 -
Headers
Accept application/vnd.api+json
Content-Type application/vnd.api+json

RESPONSE

Headers
Content-Type application/vnd.api+json; charset=utf-8
200 application/vnd.api+json; charset=utf-8
                        {
  "data": {
    "id": "1",
    "type": "book_collections",
    "attributes": {
      "name": "Book_collection_2"
    },
    "relationships": {
      "books": {
        "data": [

        ]
      }
    }
  }
}

                      
                        
                      

REQUEST does not find a book collection

GET  /api/v1/book_collections/invalid_id

Parameters
id string 1 -
Headers
Accept application/vnd.api+json
Content-Type application/vnd.api+json

RESPONSE

Headers
Content-Type application/vnd.api+json; charset=utf-8
404 application/vnd.api+json; charset=utf-8
                        {
  "errors": [

  ]
}

                      
                        
                      

Create a book collection

REQUEST creates a new book collection

POST  /api/v1/book_collections

Headers
Accept application/vnd.api+json
Content-Type application/vnd.api+json
application/vnd.api+json
                          {
  "data": {
    "type": "book_collection",
    "attributes": {
      "name": "Book_collection_5"
    }
  }
}

                        
                          
                        

RESPONSE

Headers
Content-Type application/vnd.api+json; charset=utf-8
201 application/vnd.api+json; charset=utf-8
                        {
  "data": {
    "id": "2",
    "type": "book_collections",
    "attributes": {
      "name": "Book_collection_5"
    },
    "relationships": {
      "books": {
        "meta": {
          "included": false
        }
      }
    }
  }
}

                      
                        
                      

REQUEST returns unprocessable entity

POST  /api/v1/book_collections

Headers
Accept application/vnd.api+json
Content-Type application/vnd.api+json
application/vnd.api+json
                          {
  "data": {
    "type": "book_collection",
    "attributes": {
      "name": ""
    }
  }
}

                        
                          
                        

RESPONSE

Headers
Content-Type application/vnd.api+json; charset=utf-8
422 application/vnd.api+json; charset=utf-8
                        {
  "errors": [
    {
      "title": "Unprocessable Entity",
      "detail": "Name can't be blank",
      "source": {
        "parameter": "name",
        "pointer": "data/attributes/name"
      }
    }
  ]
}

                      
                        
                      

Update a book collection

REQUEST updates the requested book collection

PUT  /api/v1/book_collections/1

Parameters
id string 1 -
Headers
Accept application/vnd.api+json
Content-Type application/vnd.api+json
application/vnd.api+json
                          {
  "data": {
    "type": "book_collection",
    "id": 1,
    "attributes": {
      "name": "New Book Collection"
    }
  }
}

                        
                          
                        

RESPONSE

Headers
Content-Type application/vnd.api+json; charset=utf-8
200 application/vnd.api+json; charset=utf-8
                        {
  "data": {
    "id": "1",
    "type": "book_collections",
    "attributes": {
      "name": "New Book Collection"
    },
    "relationships": {
      "books": {
        "meta": {
          "included": false
        }
      }
    }
  }
}

                      
                        
                      

REQUEST returns unprocessable entity

PUT  /api/v1/book_collections/1

Parameters
id string 1 -
Headers
Accept application/vnd.api+json
Content-Type application/vnd.api+json
application/vnd.api+json
                          {
  "data": {
    "type": "book_collection",
    "id": 1,
    "attributes": {
      "name": ""
    }
  }
}

                        
                          
                        

RESPONSE

Headers
Content-Type application/vnd.api+json; charset=utf-8
422 application/vnd.api+json; charset=utf-8
                        {
  "errors": [
    {
      "title": "Unprocessable Entity",
      "detail": "Name can't be blank",
      "source": {
        "parameter": "name",
        "pointer": "data/attributes/name"
      }
    }
  ]
}

                      
                        
                      

Delete a book collection

REQUEST deletes the requested book collection

DELETE  /api/v1/book_collections/1

Parameters
id string 1 -
Headers
Accept application/vnd.api+json
Content-Type application/vnd.api+json

RESPONSE

Headers
Books

Supported filter params

  • author_id

Get books

REQUEST returns books

GET  /api/v1/books

Headers
Accept application/vnd.api+json
Content-Type application/vnd.api+json

RESPONSE

Headers
Content-Type application/vnd.api+json; charset=utf-8
200 application/vnd.api+json; charset=utf-8
                        {
  "data": [
    {
      "id": "1",
      "type": "books",
      "attributes": {
        "name": "Book_1"
      },
      "relationships": {
        "author": {
          "meta": {
            "included": false
          }
        },
        "book_collection": {
          "meta": {
            "included": false
          }
        }
      }
    }
  ]
}

                      
                        
                      

Get a book

REQUEST returns a book

GET  /api/v1/books/1

Parameters
id string 1 -
Headers
Accept application/vnd.api+json
Content-Type application/vnd.api+json

RESPONSE

Headers
Content-Type application/vnd.api+json; charset=utf-8
200 application/vnd.api+json; charset=utf-8
                        {
  "data": {
    "id": "1",
    "type": "books",
    "attributes": {
      "name": "Book_2"
    },
    "relationships": {
      "author": {
        "data": {
          "type": "authors",
          "id": "1"
        }
      },
      "book_collection": {
        "data": {
          "type": "book_collections",
          "id": "1"
        }
      }
    }
  },
  "included": [
    {
      "id": "1",
      "type": "authors",
      "attributes": {
        "name": "Author_11"
      },
      "relationships": {
        "books": {
          "meta": {
            "included": false
          }
        }
      }
    },
    {
      "id": "1",
      "type": "book_collections",
      "attributes": {
        "name": "Book_collection_11"
      },
      "relationships": {
        "books": {
          "meta": {
            "included": false
          }
        }
      }
    }
  ]
}

                      
                        
                      

REQUEST does not return a book

GET  /api/v1/books/invalid_id

Parameters
id string 1 -
Headers
Accept application/vnd.api+json
Content-Type application/vnd.api+json

RESPONSE

Headers
Content-Type application/vnd.api+json; charset=utf-8
404 application/vnd.api+json; charset=utf-8
                        {
  "errors": [

  ]
}

                      
                        
                      

Create a book

REQUEST creates a new book

POST  /api/v1/books

Headers
Accept application/vnd.api+json
Content-Type application/vnd.api+json
application/vnd.api+json
                          {
  "data": {
    "type": "book",
    "attributes": {
      "name": "New Book",
      "author_id": 1
    }
  }
}

                        
                          
                        

RESPONSE

Headers
Content-Type application/vnd.api+json; charset=utf-8
201 application/vnd.api+json; charset=utf-8
                        {
  "data": {
    "id": "2",
    "type": "books",
    "attributes": {
      "name": "New Book"
    },
    "relationships": {
      "author": {
        "meta": {
          "included": false
        }
      },
      "book_collection": {
        "meta": {
          "included": false
        }
      }
    }
  }
}

                      
                        
                      

REQUEST returns unprocessable entity

POST  /api/v1/books

Headers
Accept application/vnd.api+json
Content-Type application/vnd.api+json
application/vnd.api+json
                          {
  "data": {
    "type": "book",
    "attributes": {
      "name": ""
    }
  }
}

                        
                          
                        

RESPONSE

Headers
Content-Type application/vnd.api+json; charset=utf-8
422 application/vnd.api+json; charset=utf-8
                        {
  "errors": [
    {
      "title": "Unprocessable Entity",
      "detail": "Author must exist",
      "source": {
        "parameter": "author",
        "pointer": "data/attributes/author"
      }
    },
    {
      "title": "Unprocessable Entity",
      "detail": "Name can't be blank",
      "source": {
        "parameter": "name",
        "pointer": "data/attributes/name"
      }
    }
  ]
}

                      
                        
                      

REQUEST doesn't create a new book

POST  /api/v1/books

Headers
Accept application/vnd.api+json
Content-Type application/vnd.api+json
application/vnd.api+json
                          {
  "data": {
    "type": "book",
    "attributes": {
      "name": ""
    }
  }
}

                        
                          
                        

RESPONSE

Headers
Content-Type application/vnd.api+json; charset=utf-8
422 application/vnd.api+json; charset=utf-8
                        {
  "errors": [
    {
      "title": "Unprocessable Entity",
      "detail": "Author must exist",
      "source": {
        "parameter": "author",
        "pointer": "data/attributes/author"
      }
    },
    {
      "title": "Unprocessable Entity",
      "detail": "Name can't be blank",
      "source": {
        "parameter": "name",
        "pointer": "data/attributes/name"
      }
    }
  ]
}

                      
                        
                      

Update a book

REQUEST updates the requested book

PUT  /api/v1/books/1

Parameters
id string 1 -
Headers
Accept application/vnd.api+json
Content-Type application/vnd.api+json
application/vnd.api+json
                          {
  "data": {
    "type": "book",
    "id": 1,
    "attributes": {
      "name": "New Book"
    }
  }
}

                        
                          
                        

RESPONSE

Headers
Content-Type application/vnd.api+json; charset=utf-8
200 application/vnd.api+json; charset=utf-8
                        {
  "data": {
    "id": "1",
    "type": "books",
    "attributes": {
      "name": "New Book"
    },
    "relationships": {
      "author": {
        "meta": {
          "included": false
        }
      },
      "book_collection": {
        "meta": {
          "included": false
        }
      }
    }
  }
}

                      
                        
                      

REQUEST returns unprocessable entity

PUT  /api/v1/books/1

Parameters
id string 1 -
Headers
Accept application/vnd.api+json
Content-Type application/vnd.api+json
application/vnd.api+json
                          {
  "data": {
    "type": "book",
    "id": 1,
    "attributes": {
      "name": ""
    }
  }
}

                        
                          
                        

RESPONSE

Headers
Content-Type application/vnd.api+json; charset=utf-8
422 application/vnd.api+json; charset=utf-8
                        {
  "errors": [
    {
      "title": "Unprocessable Entity",
      "detail": "Name can't be blank",
      "source": {
        "parameter": "name",
        "pointer": "data/attributes/name"
      }
    }
  ]
}

                      
                        
                      

Delete a book

REQUEST deletes the requested book

DELETE  /api/v1/books/1

Parameters
id string 1 -
Headers
Accept application/vnd.api+json
Content-Type application/vnd.api+json

RESPONSE

Headers