FreeFakeAPI.io
Free Fake API for you to play with and try to manage Ajax calls.
You'll find below the main documentation of the API version that requires authentication.
Authentification
Access the API by authentification, to process, provide your mail and your password. Then, you have to use the returned token for each of the next requests. In the software you use, put the token in "Authorization", "Bearer Token".
If you want to check the users list, please navigate to
https://freefakeapi.io/api/users. All users have
myBeaut1fu11P@ssW0rd!
as their password.
Parameters
The differents parameters to put in the body. All parameters are mandatory.
Name | Type |
---|---|
username | string |
password | string |
Examples
{
"username": "value", //the value can't be null, the mail format must be valid.
"password": "value" // The value can't be null, the password must be valid.
}
This example is working
{
"username": "MikePayne",
"password": "myBeaut1fu11P@ssW0rd!"
}
Response
Response with
200 OK
status and the token:
{
"token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxLCJlbWFpbCI6ImFkYW42MUBleGFtcGxlLm5ldCIsImlhdCI6MTYzMDA5MjI5OSwiZXhwIjoxNjMwMTc4Njk5fQ.-Dct6gG0-dA_1QB30UQoTqcmB-N3orhADeCYg_5TDVY"
}
Users
Get the full list of users provided by the API. In the software you use, put the token in "Authorization", "Bearer Token".
All users on this API have
myBeaut1fu11P@ssW0rd!
as password.
The
session
property is the token validity in seconds.
Parameters
Nothing in the request body, the get request MUST be empty
Response
Response with
200 OK
status and full resources:
[
{
"id": "1",
"username": "johndoe",
"email": "john@doe.com",
"session": "3600",
"_links": {
"self": {
"href": "/authapi/users/1"
}
}
},
{
"id": "2",
"username": "TheOne",
"email": "theone@example.com",
"session": "1200",
"_links": {
"self": {
"href": "/authapi/users/2"
}
}
}
]
Get a single user resource provided by the API.
All users on this API have
myBeaut1fu11P@ssW0rd!
as password.
The
session
property is the token validity in seconds.
Parameters
Replace
{id}
in the url by the id of the user you want to get, like
/authapi/users/3
Nothing in the request body, the get request MUST be empty
Response
Response with
200 OK
status and full resource:
{
"id": "2",
"username": "TheOne",
"email": "theone@example.com",
"session": "1200",
"_links": {
"self": {
"href": "/authapi/users/2"
}
}
}
Posts
Get the full list of posts provided by the API.
Parameters
Nothing in the request body, the get request MUST be empty
The differents parameters to put in the URL
Name | Type |
---|---|
limit | integer |
Example
URL
https://freefakeapi.io/authapi/posts
will return all posts
URL
https://freefakeapi.io/authapi/posts?limit=6
will return 6 posts
Response
Response with
200 OK
status and the collection:
[
{
"id": 1,
"title": "This is a test article",
"content": "This is an article to test the API",
"slug": "this-is-a-test-article",
"picture": "https://fakeimg.pl/350x200/?text=FreeFakeAPI",
"user": "/authapi/users/1",
"_links": {
"self": {
"href": "/authapi/posts/1"
},
"modify": {
"href": "/authapi/posts/1"
},
"delete": {
"href": "/authapi/posts/1"
}
}
},
{
"id": 2,
"title": "This is another test article",
"content": "This is another article to test the API",
"slug": "this-is-another-test-article",
"picture": "https://fakeimg.pl/350x200/?text=FreeFakeAPI",
"user": "/authapi/users/5",
"_links": {
"self": {
"href": "/authapi/posts/2"
},
"modify": {
"href": "/authapi/posts/2"
},
"delete": {
"href": "/authapi/posts/2"
}
}
}
]
Get a single post resource provided by the API.
Parameters
Replace
{id}
in the url by the id of the post you want to get, like
/authapi/posts/3
Nothing in the request body, the get request MUST be empty
Response
Response with
200 OK
status and the resource:
{
"id": 2,
"title": "This is another test article",
"content": "This is another article to test the API",
"slug": "this-is-another-test-article",
"picture": "https://fakeimg.pl/350x200/?text=FreeFakeAPI",
"user": "/authapi/users/5",
"_links": {
"self": {
"href": "/authapi/posts/2"
},
"modify": {
"href": "/authapi/posts/2"
},
"delete": {
"href": "/authapi/posts/2"
}
}
}
Add a single post resource in the API (this is only a simulation, no real post created).
Parameters
The differents parameters to put in the body (all parameters are mandatory)
Name | Type |
---|---|
title | string |
content | string |
slug | string |
picture | url (string) |
user | integer |
Example
{
"title": "This is the title",
"content": "This is the post content",
"slug": "this-is-the-slug",
"picture": "https://path.to/picture.jpg",
"user": 5
}
Response
Response with
201 Created
status and the resource:
{
"id": 43,
"title": "This is the title",
"content": "This is the post content",
"slug": "this-is-the-slug",
"picture": "https://path.to/picture.jpg",
"user": "/authapi/users/5",
"_links": {
"self": {
"href": "/authapi/posts/43"
},
"modify": {
"href": "/authapi/posts/43"
},
"delete": {
"href": "/authapi/posts/43"
}
}
}
Update a single post resource in the API, if resource doesn't exist, it's created (this is only a simulation, no real post created or updated).
Replace
{id}
in the url by the id of the post you want to get, like
/authapi/posts/3
Parameters
The differents parameters to put in the body (all parameters are mandatory)
Name | Type |
---|---|
id | integer |
title | string |
content | string |
slug | string |
picture | url (string) |
user | integer |
Example
{
"id": 43,
"title": "This is the title",
"content": "This is the post content",
"slug": "this-is-the-slug",
"picture": "https://path.to/picture.jpg",
"user": 5
}
Responses
In case resource doesn't exist, response with
201 Created
status and full resource:
{
"id": 43,
"title": "This is the title",
"content": "This is the post content",
"slug": "this-is-the-slug",
"picture": "https://path.to/picture.jpg",
"user": "/authapi/users/5",
"_links": {
"self": {
"href": "/authapi/posts/43"
},
"modify": {
"href": "/authapi/posts/43"
},
"delete": {
"href": "/authapi/posts/43"
}
}
}
In case resource exists, response with
200 OK
status and full resource:
{
"id": 43,
"title": "This is the title",
"content": "This is the post content",
"slug": "this-is-the-slug",
"picture": "https://path.to/picture.jpg",
"user": "/authapi/users/5",
"_links": {
"self": {
"href": "/authapi/posts/43"
},
"modify": {
"href": "/authapi/posts/43"
},
"delete": {
"href": "/authapi/posts/43"
}
}
}
Update a single post resource in the API (this is only a simulation, no real post updated).
Replace
{id}
in the url by the id of the post you want to get, like
/authapi/posts/3
Parameters
The differents parameters to put in the body (any of those parameters, at least one)
Name | Type |
---|---|
title | string |
content | string |
slug | string |
picture | url (string) |
user | integer |
Example
{
"title": "This is the title",
"picture": "https://path.to/picture.jpg"
}
Responses
Response with
204 No content
status and empty body.
Delete a single post resource in the API (this is only a simulation, no real post deleted).
Replace
{id}
in the url by the id of the post you want to get, like
/authapi/posts/3
Parameters
Nothing in the request body, the get request MUST be empty
Comments
Get the full list of comments provided by the API.
Parameters
Nothing in the request body, the get request MUST be empty
Response
Response with
200 OK
status with the collection of comments:
[
{
"id": "1",
"content": "I'm so happy with the quality of this post !",
"user": "/authapi/users/1",
"post": "/authapi/posts/2",
"_links": {
"self": {
"href": "/authapi/comments/1"
},
"modify": {
"href": "/authapi/comments/1"
},
"delete": {
"href": "/authapi/comments/1"
}
}
},
{
"id": "2",
"content": "This post is really a good piece of work !",
"user": "/authapi/users/4",
"post": "/authapi/posts/1",
"_links": {
"self": {
"href": "/authapi/comments/2"
},
"modify": {
"href": "/authapi/comments/2"
},
"delete": {
"href": "/authapi/comments/2"
}
}
}
]
Get a single comment resource provided by the API.
Parameters
Replace
{id}
in the url by the id of the comment you want to get, like
/authapi/comments/3
Nothing in the request body, the get request MUST be empty
Response
Response with
200 OK
status and the resource:
{
"id": "2",
"content": "This post is really a good piece of work !",
"user": "/authapi/users/4",
"post": "/authapi/posts/1",
"_links": {
"self": {
"href": "/authapi/comments/2"
},
"modify": {
"href": "/authapi/comments/2"
},
"delete": {
"href": "/authapi/comments/2"
}
}
}
Add a single comment resource in the API (this is only a simulation, no real comment created).
Parameters
The differents parameters to put in the body (all parameters are mandatory)
Name | Type |
---|---|
content | string |
user | integer |
post | integer |
Example
{
"content": "This is the comment content",
"user": 1,
"post": 5
}
Response
Response with
201 Created
status and the full resource in body:
{
"id": 250,
"content": "This is the comment content",
"user": "/authapi/users/1",
"post": "/authapi/posts/5",
"_links": {
"self": {
"href": "/authapi/comments/250"
},
"modify": {
"href": "/authapi/comments/250"
},
"delete": {
"href": "/authapi/comments/250"
}
}
}
Update a single comment resource in the API, if resource doesn't exist, it's created (this is only a simulation, no real comment created or updated).
Replace
{id}
in the url by the id of the comment you want to get, like
/authapi/comments/3
Parameters
The differents parameters to put in the body (all parameters are mandatory)
Name | Type |
---|---|
id | integer |
content | string |
user | integer |
post | integer |
Example
{
"id": 3,
"content": "This is the comment content",
"user": 1,
"post": 5
}
Responses
In case resource doesn't exist, response with
201 Created
status and full resource:
{
"id": 3,
"content": "This is the comment content",
"user": "/authapi/users/1",
"post": "/authapi/posts/5",
"_links": {
"self": {
"href": "/authapi/comments/3"
},
"modify": {
"href": "/authapi/comments/3"
},
"delete": {
"href": "/authapi/comments/3"
}
}
}
In case resource exists, response with
200 OK
status and full resource:
{
"id": 3,
"content": "This is the comment content",
"user": "/authapi/users/1",
"post": "/authapi/posts/5",
"_links": {
"self": {
"href": "/authapi/comments/3"
},
"modify": {
"href": "/authapi/comments/3"
},
"delete": {
"href": "/authapi/comments/3"
}
}
}
Update a single comment resource in the API (this is only a simulation, no real comment updated).
Replace
{id}
in the url by the id of the comment you want to get, like
/authapi/comments/3
Parameters
The differents parameters to put in the body (any of those parameters, at least one)
Name | Type |
---|---|
content | string |
user | integer |
post | integer |
Example
{
"title": "This is the title",
"picture": "https://path.to/picture.jpg"
}
Responses
Response with
204 No content
status and empty body.
Delete a single comment resource in the API (this is only a simulation, no real comment deleted).
Replace
{id}
in the url by the id of the comment you want to get, like
/authapi/comments/3
Parameters
Nothing in the request body, the get request MUST be empty