Home

FreeFakeAPI Logo 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 doesn't require authentication.


Users

Get users collection

GET /api/users

+

Get the full list of users provided by the API.

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": "/api/users/1"
            }
        }
    },
    {
        "id": "2",
        "username": "TheOne",
        "email": "theone@example.com",
        "session": "1200",
        "_links": {
            "self": {
                "href": "/api/users/2"
            }
        }
    }
]

Get single user resource

GET /api/users/{id}

+

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 /api/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": "/api/users/2"
        }
    }
}

Posts

Get posts collection

GET /api/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/api/posts will return all posts

URL https://freefakeapi.io/api/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": "/api/users/1",
        "_links": {
            "self": {
                "href": "/api/api/posts/1"
            },
            "modify": {
                "href": "/api/api/posts/1"
            },
            "delete": {
                "href": "/api/api/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": "/api/users/5",
        "_links": {
            "self": {
                "href": "/api/posts/2"
            },
            "modify": {
                "href": "/api/posts/2"
            },
            "delete": {
                "href": "/api/posts/2"
            }
        }
    }
]

Get single post resource

GET /api/posts/{id}

+

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 /api/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": "/api/users/5",
    "_links": {
        "self": {
            "href": "/api/posts/2"
        },
        "modify": {
            "href": "/api/posts/2"
        },
        "delete": {
            "href": "/api/posts/2"
        }
    }
}

Add a post resource

POST /api/posts

+

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": "/api/users/5",
    "_links": {
        "self": {
            "href": "/api/posts/43"
        },
        "modify": {
            "href": "/api/posts/43"
        },
        "delete": {
            "href": "/api/posts/43"
        }
    }
}

Update fully a post resource

PUT /api/posts/{id}

+

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 /api/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": "/api/users/5",
    "_links": {
        "self": {
            "href": "/api/posts/43"
        },
        "modify": {
            "href": "/api/posts/43"
        },
        "delete": {
            "href": "/api/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": "/api/users/5",
    "_links": {
        "self": {
            "href": "/api/posts/43"
        },
        "modify": {
            "href": "/api/posts/43"
        },
        "delete": {
            "href": "/api/posts/43"
        }
    }
}

Update (patch) a post resource

PATCH /api/posts/{id}

+

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 /api/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 post resource

DELETE /api/posts/{id}

+

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 /api/posts/3

Parameters

Nothing in the request body, the get request MUST be empty


Comments

Get comments collection

GET /api/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": "/api/users/1",
        "post": "/api/posts/2",
        "_links": {
            "self": {
                "href": "/api/comments/1"
            },
            "modify": {
                "href": "/api/comments/1"
            },
            "delete": {
                "href": "/api/comments/1"
            }
        }
    },
    {
        "id": "2",
        "content": "This post is really a good piece of work !",
        "user": "/api/users/4",
        "post": "/api/posts/1",
        "_links": {
            "self": {
                "href": "/api/comments/2"
            },
            "modify": {
                "href": "/api/comments/2"
            },
            "delete": {
                "href": "/api/comments/2"
            }
        }
    }
]

Get single comment resource

GET /api/comments/{id}

+

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 /api/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": "/api/users/4",
    "post": "/api/posts/1",
    "_links": {
        "self": {
            "href": "/api/comments/2"
        },
        "modify": {
            "href": "/api/comments/2"
        },
        "delete": {
            "href": "/api/comments/2"
        }
    }
}

Add a comment resource

POST /api/comments

+

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": "/api/users/1",
    "post": "/api/posts/5",
    "_links": {
        "self": {
            "href": "/api/comments/250"
        },
        "modify": {
            "href": "/api/comments/250"
        },
        "delete": {
            "href": "/api/comments/250"
        }
    }
}

Update fully a comment resource

PUT /api/comments/{id}

+

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 /api/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": "/api/users/1",
    "post": "/api/posts/5",
    "_links": {
        "self": {
            "href": "/api/comments/3"
        },
        "modify": {
            "href": "/api/comments/3"
        },
        "delete": {
            "href": "/api/comments/3"
        }
    }
}

In case resource exists, response with 200 OK status and full resource:

{
    "id": 3,
    "content": "This is the comment content",
    "user": "/api/users/1",
    "post": "/api/posts/5",
    "_links": {
        "self": {
            "href": "/api/comments/3"
        },
        "modify": {
            "href": "/api/comments/3"
        },
        "delete": {
            "href": "/api/comments/3"
        }
    }
}

Update (patch) a comment resource

PATCH /api/comments/{id}

+

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 /api/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 comment resource

DELETE /api/comments/{id}

+

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 /api/comments/3

Parameters

Nothing in the request body, the get request MUST be empty