-
Notifications
You must be signed in to change notification settings - Fork 0
hosts
The hosts endpoint is used to list and create hosts.
The get endpoints do not use any body text.
-
/api/hostsreturns all hosts . - Authenticated users only! -
/api/hosts/[id]returns hosts with specificid.
-
[]- There are no hosts to show -
404- The specific hosts you're looking for doesn't exist.
200 OK - returns a JSON object with all/specific host(s).
The post endpoints require all body data as described.
-
/api/hostsreturns the data added to the DB.-
first_name(required, string, max:191) - The first name -
last_name(required, text) - The last name. -
description(required, string) - The host description. -
picture(required, active_url) - The host picture.
-
- Error is only trown when body data is incorrect. Errors are in english like the example below.
{
"message": "The given data was invalid.",
"errors": {
"picture": [
"The picture is not a valid URL."
],
}
}
201 Created - returns a JSON object with the created host data.
The put endpoints do not require anything in the body. Only add the fields you want to change to the body.
-
/api/hosts/[id]returns the entire (edited) host .-
first_name(string, max:191) - The first name -
last_name(text) - The last name. -
description(string) - The host description. -
picture(active_url) - The host picture.
-
- Errors are equal to the
create endpoint - No error will be trown when the body is empty
200 OK - returns a JSON object with the updated host data.
The delete endpoint does not require anything in the body.
-
/api/hosts/[id]removes the host and returns it.
404 Not found - The requested host does not exist
200 OK - returns a JSON object with the removed host.
The post endpoints require all body data as described.
-
/api/hosts/followreturns the data added to the DB.-
host_id(required, uuid, exists in host table) - The host_id from the host you want to follow.
-
- Error is only thrown when the user is unauthenticated or the host doesn't exist.
201 Created - returns a JSON object with the followed host data.
The delete endpoints does not require any body data.
-
/api/hosts/unfollow/{host_id}returns the unfollowed host data.
- Error is only thrown when the user is unauthenticated or the host doesn't exist.
201 Created - returns a JSON object with the unfollowed host data.
The get endpoints does not require any body data.
-
/api/hosts/followers/{host_id}returns the total followers of that host.
- Error is only thrown when the user is unauthenticated or the host doesn't exist.
201 Created - returns a JSON object with the total host followers.