Attention!
Copied to clipboard.

Usage Guide

Usage Guide Illustration

When to use TheTestRequest API?

TheTestRequest is a free online REST API that you can use whenever you need some fake data.

Some common use cases are:

Pagination

Pagination is supported across the board, all pagination related information is exposed in response headers.

Details

You acn control pagination with the following parameters

Resources

As of now, there are three resources exposed by TheTestRequest API.

Authors Has Many Articles Has Many Comments

Authors

Author is a root resource of TheTestRequest API.

Details

  • Total Resources: 5
  • Valid Ids: 1 - 5

Attributes

  • id - Integer (Primary key)
  • name - String
  • email - String
  • avatar - Text (url)
  • created_at - Timestamp
  • updated_at - Timestamp

Routes

XML responses?

Author has the following routes

Get all authors

GET - https://thetestrequest.com/authors.xml

Accepted params (optional)
  • include=articles

Get a single author

GET - https://thetestrequest.com/authors/1.xml

Accepted params (optional)
  • include=articles

Create an Author

NOTE - Response of this request is fake i.e. No data will be saved on server.

POST - https://thetestrequest.com/authors.xml

Accepted data (JSON object)
          
            {
            "author": {
            "name": "Author Name",
            "email": "random@example.com",
            "avatar": "URL"
            }
            }
          
          

Update an Author

NOTE - Response of this request is fake i.e. No data will be saved on server.

PUT/PATCH - https://thetestrequest.com/authors/1.xml

Accepted data (JSON object)
                            
                                {
                                    "author": {
                                        "name": "Author Name",
                                        "email": "random@example.com",
                                        "avatar": "URL"
                                    }
                                }
                            
                        

Delete an Author

NOTE - Response of this request is fake i.e. No data will be saved on server.

DELETE - https://thetestrequest.com/authors/1.xml

Articles

In TestRequestAPI an "Author" has many "Articles".

Details

  • Total Resources: 100 (20 per Author)
  • Valid Ids: 1 - 100

Attributes

  • id - Integer (Primary key)
  • title - String
  • body - String (rich-text)
  • likes - Integer
  • views - Integer
  • author_id - Integer (fk)
  • created_at - Timestamp
  • updated_at - Timestamp

Routes

XML responses?

Article has the following routes

Get all articles

GET - https://thetestrequest.com/articles.xml

Accepted params (optional)
  • include=author
  • include=comments

Get all articles of a specific author

GET - https://thetestrequest.com/authors/1/articles.xml

Accepted params (optional)
  • include=author
  • include=comments

Get a single article

GET - https://thetestrequest.com/authors/1/articles/1.xml

Accepted params (optional)
  • include=author
  • include=comments
  • include=all (this will include both author & comments)

Create an Article

NOTE - Response of this request is fake i.e. No data will be saved on server.

POST - https://thetestrequest.com/authors/1/articles.xml

Accepted data (JSON object)
                            
                                {
                                    "article": {
                                        "title": "Title of Article",
                                        "body": "Article Content",
                                        "views": 100,
                                        "likes": 35
                                    }
                                }
                            
                        

Update an Article

NOTE - Response of this request is fake i.e. No data will be saved on server.

PUT/PATCH - https://thetestrequest.com/authors/1/articles/1.xml

Accepted data (JSON object)
                            
                                {
                                    "article": {
                                        "title": "Title of Article",
                                        "body": "Article Content",
                                        "views": 100,
                                        "likes": 35
                                    }
                                }
                            
                        

Delete an Article

NOTE - Response of this request is fake i.e. No data will be saved on server.

DELETE - https://thetestrequest.com/authors/1/articles/1.xml

Comments

In TestRequestAPI an "Article" has many "Comments".

Details

  • Total Resources: 500 (5 per Article)
  • Valid Ids: 1 - 500

Attributes

  • id - Integer (Primary key)
  • body - String
  • written_by - String
  • article_id - Integer (fk)
  • created_at - Timestamp
  • updated_at - Timestamp

Routes

XML responses?

Comment has the following routes

Get all Comments against an Article

GET - https://thetestrequest.com/articles/1/comments.xml

Accepted params (optional)
  • include=article

Get a single Comment against an Article

GET - https://thetestrequest.com/articles/1/comments/1.xml

Accepted params (optional)
  • include=article

Create a Comment against an Article

NOTE - Response of this request is fake i.e. No data will be saved on server.

POST - https://thetestrequest.com/articles/1/comments.xml

Accepted data (JSON object)
                            
                                {
                                    "comment": {
                                        "body": "Comment Body",
                                        "written_by": "Writer Name"
                                    }
                                }
                            
                        

Update a Comment

NOTE - Response of this request is fake i.e. No data will be saved on server.

PUT/PATCH - https://thetestrequest.com/articles/1/comments/1.xml

Accepted data (JSON object)
                            
                                {
                                    "comment": {
                                        "body": "Comment Body",
                                        "written_by": "Writer Name"
                                    }
                                }
                            
                        

Delete a Comment

NOTE - Response of this request is fake i.e. No data will be saved on server.

DELETE - https://thetestrequest.com/articles/1/comments/1.xml