Introduction

Authenticating requests

To authenticate requests, include an Authorization header with the value "Bearer {YOUR_TOKEN_KEY}".

All authenticated endpoints are marked with a requires authentication badge in the documentation below.

Contact udruga@citati.hr if you are interested in API integration.

Authors

Get authors

GET
https://api.citati.hr
/authors
requires authentication

Headers

Authorization
Example:
Bearer {YOUR_TOKEN_KEY}
Content-Type
Example:
application/json
Accept
Example:
application/json

Query Parameters

page
integer

Page number to retrieve. Default 1.

Example:
1
per_page
integer

between:1,100 Number of items per page. Default 10.

Example:
10
Example request:
const url = new URL(
    "https://api.citati.hr/authors"
);

const params = {
    "page": "1",
    "per_page": "10",
};
Object.keys(params)
    .forEach(key => url.searchParams.append(key, params[key]));

const headers = {
    "Authorization": "Bearer {YOUR_TOKEN_KEY}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
Example response:
Headers
                                                            cache-control
                                                            : no-cache, private
                                                                                                                    content-type
                                                            : application/json
                                                                                                                    access-control-allow-origin
                                                            : *
                                                         
{
    "message": "Unauthenticated."
}
GET
https://api.citati.hr
/authors/search
requires authentication

Headers

Authorization
Example:
Bearer {YOUR_TOKEN_KEY}
Content-Type
Example:
application/json
Accept
Example:
application/json

Query Parameters

page
integer

Page number to retrieve. Default 1.

Example:
1
per_page
integer

between:1,30 Number of items per page. Default 10.

Example:
10
query
string
required

Search terms. Default none.

Example:
lorem
Example request:
const url = new URL(
    "https://api.citati.hr/authors/search"
);

const params = {
    "page": "1",
    "per_page": "10",
    "query": "lorem",
};
Object.keys(params)
    .forEach(key => url.searchParams.append(key, params[key]));

const headers = {
    "Authorization": "Bearer {YOUR_TOKEN_KEY}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
Example response:

Get author

GET
https://api.citati.hr
/authors/{author_id}
requires authentication

Headers

Authorization
Example:
Bearer {YOUR_TOKEN_KEY}
Content-Type
Example:
application/json
Accept
Example:
application/json

URL Parameters

author_id
integer

required_without:author_slug The ID of the author.

Example:
1
author_slug
string

required_without:author_id The slug of the author.

Example:
lorem-ipsum
Example request:
const url = new URL(
    "https://api.citati.hr/authors/1"
);

const headers = {
    "Authorization": "Bearer {YOUR_TOKEN_KEY}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
Example response:
Headers
                                                            cache-control
                                                            : no-cache, private
                                                                                                                    content-type
                                                            : application/json
                                                                                                                    access-control-allow-origin
                                                            : *
                                                         
{
    "message": "Unauthenticated."
}

Collections

Get collections

GET
https://api.citati.hr
/collections
requires authentication

Headers

Authorization
Example:
Bearer {YOUR_TOKEN_KEY}
Content-Type
Example:
application/json
Accept
Example:
application/json

Query Parameters

page
integer

Page number to retrieve. Default 1.

Example:
1
per_page
integer

between:1,100 Number of items per page. Default 10.

Example:
10
order_by
string

Must be one of latest, relevant, random, featured, or popular. How to sort the collections. Default latest.

Example:
random
type
string

Must be one of text or gallery. Default all.

Example:
text
Example request:
const url = new URL(
    "https://api.citati.hr/collections"
);

const params = {
    "page": "1",
    "per_page": "10",
    "order_by": "random",
    "type": "text",
};
Object.keys(params)
    .forEach(key => url.searchParams.append(key, params[key]));

const headers = {
    "Authorization": "Bearer {YOUR_TOKEN_KEY}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
Example response:
Headers
                                                            cache-control
                                                            : no-cache, private
                                                                                                                    content-type
                                                            : application/json
                                                                                                                    access-control-allow-origin
                                                            : *
                                                         
{
    "message": "Unauthenticated."
}
GET
https://api.citati.hr
/collections/search
requires authentication

Headers

Authorization
Example:
Bearer {YOUR_TOKEN_KEY}
Content-Type
Example:
application/json
Accept
Example:
application/json

Query Parameters

page
integer

Page number to retrieve. Default 1.

Example:
1
per_page
integer

between:1,30 Number of items per page. Default 10.

Example:
10
query
string
required

Search terms. Default none.

Example:
lorem
Example request:
const url = new URL(
    "https://api.citati.hr/collections/search"
);

const params = {
    "page": "1",
    "per_page": "10",
    "query": "lorem",
};
Object.keys(params)
    .forEach(key => url.searchParams.append(key, params[key]));

const headers = {
    "Authorization": "Bearer {YOUR_TOKEN_KEY}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
Example response:

Get collection

GET
https://api.citati.hr
/collections/{collection_id}
requires authentication

Headers

Authorization
Example:
Bearer {YOUR_TOKEN_KEY}
Content-Type
Example:
application/json
Accept
Example:
application/json

URL Parameters

collection_id
integer

required_without:collection_slug The ID of the collection.

Example:
1
collection_slug
string

required_without:collection_id The slug of the collection.

Example:
quotes
Example request:
const url = new URL(
    "https://api.citati.hr/collections/1"
);

const headers = {
    "Authorization": "Bearer {YOUR_TOKEN_KEY}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
Example response:
Headers
                                                            cache-control
                                                            : no-cache, private
                                                                                                                    content-type
                                                            : application/json
                                                                                                                    access-control-allow-origin
                                                            : *
                                                         
{
    "message": "Unauthenticated."
}

Interactions

Create interaction

POST
https://api.citati.hr
/interactions
requires authentication

Headers

Authorization
Example:
Bearer {YOUR_TOKEN_KEY}
Content-Type
Example:
application/json
Accept
Example:
application/json

Body Parameters

Example request:
const url = new URL(
    "https://api.citati.hr/interactions"
);

const headers = {
    "Authorization": "Bearer {YOUR_TOKEN_KEY}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "post_id": 1,
    "collection_id": 1,
    "user_id": 2,
    "type": "like"
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());

Posts

Get posts

GET
https://api.citati.hr
/posts
requires authentication

Headers

Authorization
Example:
Bearer {YOUR_TOKEN_KEY}
Content-Type
Example:
application/json
Accept
Example:
application/json

Query Parameters

page
integer

Page number to retrieve. Default 1.

Example:
1
per_page
integer

between:1,100 Number of items per page. Default 10.

Example:
10
collections
string

Collection ID/slugs(‘s) to filter posts. If multiple, comma-separated. Default none.

Example:
1
authors
string

Author ID/slugs(‘s) to filter posts. If multiple, comma-separated. Default none.

Example:
1
topics
string

Topic ID/slugs(‘s) to filter posts. If multiple, comma-separated. Default none.

Example:
1
order_by
string

Must be one of latest, relevant, random, featured, or popular. How to sort the posts. Default latest.

Example:
random
Example request:
const url = new URL(
    "https://api.citati.hr/posts"
);

const params = {
    "page": "1",
    "per_page": "10",
    "collections": "1",
    "authors": "1",
    "topics": "1",
    "order_by": "random",
};
Object.keys(params)
    .forEach(key => url.searchParams.append(key, params[key]));

const headers = {
    "Authorization": "Bearer {YOUR_TOKEN_KEY}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
Example response:
Headers
                                                            cache-control
                                                            : no-cache, private
                                                                                                                    content-type
                                                            : application/json
                                                                                                                    access-control-allow-origin
                                                            : *
                                                         
{
    "message": "Unauthenticated."
}
GET
https://api.citati.hr
/posts/search
requires authentication

Headers

Authorization
Example:
Bearer {YOUR_TOKEN_KEY}
Content-Type
Example:
application/json
Accept
Example:
application/json

Query Parameters

page
integer

Page number to retrieve. Default 1.

Example:
1
per_page
integer

between:1,30 Number of items per page. Default 10.

Example:
10
query
string
required

Search terms. Default none.

Example:
lorem
Example request:
const url = new URL(
    "https://api.citati.hr/posts/search"
);

const params = {
    "page": "1",
    "per_page": "10",
    "query": "lorem",
};
Object.keys(params)
    .forEach(key => url.searchParams.append(key, params[key]));

const headers = {
    "Authorization": "Bearer {YOUR_TOKEN_KEY}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
Example response:

Get post

GET
https://api.citati.hr
/posts/{post_id}
requires authentication

Headers

Authorization
Example:
Bearer {YOUR_TOKEN_KEY}
Content-Type
Example:
application/json
Accept
Example:
application/json

URL Parameters

post_id
integer

required_without:post_slug The ID of the post.

Example:
1
post_slug
string

required_without:post_id The UID of the post.

Example:
X6eK2zR
Example request:
const url = new URL(
    "https://api.citati.hr/posts/1"
);

const headers = {
    "Authorization": "Bearer {YOUR_TOKEN_KEY}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
Example response:
Headers
                                                            cache-control
                                                            : no-cache, private
                                                                                                                    content-type
                                                            : application/json
                                                                                                                    access-control-allow-origin
                                                            : *
                                                         
{
    "message": "Unauthenticated."
}

Topics

Get topics

GET
https://api.citati.hr
/topics
requires authentication

Headers

Authorization
Example:
Bearer {YOUR_TOKEN_KEY}
Content-Type
Example:
application/json
Accept
Example:
application/json

Query Parameters

page
integer

Page number to retrieve. Default 1.

Example:
1
per_page
integer

between:1,100 Number of items per page. Default 10.

Example:
10
Example request:
const url = new URL(
    "https://api.citati.hr/topics"
);

const params = {
    "page": "1",
    "per_page": "10",
};
Object.keys(params)
    .forEach(key => url.searchParams.append(key, params[key]));

const headers = {
    "Authorization": "Bearer {YOUR_TOKEN_KEY}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
Example response:
Headers
                                                            cache-control
                                                            : no-cache, private
                                                                                                                    content-type
                                                            : application/json
                                                                                                                    access-control-allow-origin
                                                            : *
                                                         
{
    "message": "Unauthenticated."
}
GET
https://api.citati.hr
/topics/search
requires authentication

Headers

Authorization
Example:
Bearer {YOUR_TOKEN_KEY}
Content-Type
Example:
application/json
Accept
Example:
application/json

Query Parameters

page
integer

Page number to retrieve. Default 1.

Example:
1
per_page
integer

between:1,30 Number of items per page. Default 10.

Example:
10
query
string
required

Search terms. Default none.

Example:
lorem
Example request:
const url = new URL(
    "https://api.citati.hr/topics/search"
);

const params = {
    "page": "1",
    "per_page": "10",
    "query": "lorem",
};
Object.keys(params)
    .forEach(key => url.searchParams.append(key, params[key]));

const headers = {
    "Authorization": "Bearer {YOUR_TOKEN_KEY}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
Example response:

Get topic

GET
https://api.citati.hr
/topics/{topic_id}
requires authentication

Headers

Authorization
Example:
Bearer {YOUR_TOKEN_KEY}
Content-Type
Example:
application/json
Accept
Example:
application/json

URL Parameters

topic_id
integer

required_without:topic_slug The ID of the topic.

Example:
1
topic_slug
string

required_without:topic_id The slug of the topic.

Example:
lorem
Example request:
const url = new URL(
    "https://api.citati.hr/topics/1"
);

const headers = {
    "Authorization": "Bearer {YOUR_TOKEN_KEY}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
Example response:
Headers
                                                            cache-control
                                                            : no-cache, private
                                                                                                                    content-type
                                                            : application/json
                                                                                                                    access-control-allow-origin
                                                            : *
                                                         
{
    "message": "Unauthenticated."
}