Blog Posts
This will return all Blog Posts. You can do a custom search by providing a id
. Example is provided at Blog post by id.
If any erros occur you can access the errors guide.
Parameters
includequery string
Include associations (delimited with comma). Available associations: user, chapters.
Example:
user,chapters
sortquery string
Sort ascending or descending order.
langquery string
Get blog post by a certain language.
pagequery integer
Page offset to fetch.
per_pagequery integer
Number of results to return per page.
{
const res = await fetch(`${BASE_URL}/api/v1/blog_posts`, {
method: 'GET',
headers: {
'Content-Type': 'application/json'
}});
const data = await res.json();
}
{
"data": [
{
"id": "62a05bd2-2f0e-4bac-8f8b-63947f4df16f",
"type": "blog-posts",
"links": {
"self": "/blog-posts/62a05bd2-2f0e-4bac-8f8b-63947f4df16f"
},
"attributes": {
"alt-text": null,
"name": "asdf",
"headline": "asdf",
"summary": "summary",
"read-duration": 3,
"date": "2022-03-01",
"cover-picture": {
"url": "https://foodetective-staging-backend-data.s3.amazonaws.com/uploads/blog_post/cover_picture/62a05bd2-2f0e-4bac-8f8b-63947f4df16f/8077896a-c988-4ed3-bf85-ff7ed48ff77d.png",
"desktop": {
"url": "https://foodetective-staging-backend-data.s3.amazonaws.com/uploads/blog_post/cover_picture/62a05bd2-2f0e-4bac-8f8b-63947f4df16f/desktop_8077896a-c988-4ed3-bf85-ff7ed48ff77d.png"
},
"tablet": {
"url": "https://foodetective-staging-backend-data.s3.amazonaws.com/uploads/blog_post/cover_picture/62a05bd2-2f0e-4bac-8f8b-63947f4df16f/tablet_8077896a-c988-4ed3-bf85-ff7ed48ff77d.png"
}
},
"category": "blogpost",
"author-name": "Temple Howell",
"created-at": "2022-03-03T14:05:41.073Z",
"detected-language": "en",
"slug": "asdf",
"language-settings": {
"en": true,
"es": false,
"fr": false,
"ge": false,
"it": false,
"de": false
}
},
"relationships": {
"user": {
"links": {
"self": "/blog-posts/62a05bd2-2f0e-4bac-8f8b-63947f4df16f/relationships/user",
"related": "/blog-posts/62a05bd2-2f0e-4bac-8f8b-63947f4df16f/user"
}
},
"chapters": {
"links": {
"self": "/blog-posts/62a05bd2-2f0e-4bac-8f8b-63947f4df16f/relationships/chapters",
"related": "/blog-posts/62a05bd2-2f0e-4bac-8f8b-63947f4df16f/chapters"
}
}
}
}
],
"meta": {
"total-count": 1,
"total-pages": 1
}
}
Blog Post by id
This will return a Blog Posts by provided id
.
Parameters
idpath integerRequired
Returns a specific blog post by the provided
id
. You can retrieve thisid
from the response of any blog post.includequery string
Include associations (delimited with comma). Available associations: user, chapters.
languagequery string
Return results of Business by language ISO 639‑1 code.
{
const res = await fetch(`${BASE_URL}/api/v1/blog_posts/${id}`, {
method: 'GET',
headers: {
'Content-Type': 'application/json'
}});
const data = await res.json();
}
{
"data": {
"id": "62a05bd2-2f0e-4bac-8f8b-63947f4df16f",
"type": "blog-posts",
"links": {
"self": "/blog-posts/62a05bd2-2f0e-4bac-8f8b-63947f4df16f"
},
"attributes": {
"alt-text": null,
"name": "asdf",
"headline": "asdf",
"summary": "summary",
"read-duration": 3,
"date": "2022-03-01",
"cover-picture": {
"url": "https://foodetective-staging-backend-data.s3.amazonaws.com/uploads/blog_post/cover_picture/62a05bd2-2f0e-4bac-8f8b-63947f4df16f/8077896a-c988-4ed3-bf85-ff7ed48ff77d.png",
"desktop": {
"url": "https://foodetective-staging-backend-data.s3.amazonaws.com/uploads/blog_post/cover_picture/62a05bd2-2f0e-4bac-8f8b-63947f4df16f/desktop_8077896a-c988-4ed3-bf85-ff7ed48ff77d.png"
},
"tablet": {
"url": "https://foodetective-staging-backend-data.s3.amazonaws.com/uploads/blog_post/cover_picture/62a05bd2-2f0e-4bac-8f8b-63947f4df16f/tablet_8077896a-c988-4ed3-bf85-ff7ed48ff77d.png"
}
},
"category": "blogpost",
"author-name": "Temple Howell",
"created-at": "2022-03-03T14:05:41.073Z",
"detected-language": "en",
"slug": "asdf",
"language-settings": {
"en": true,
"es": false,
"fr": false,
"ge": false,
"it": false,
"de": false
}
},
"relationships": {
"user": {
"links": {
"self": "/blog-posts/62a05bd2-2f0e-4bac-8f8b-63947f4df16f/relationships/user",
"related": "/blog-posts/62a05bd2-2f0e-4bac-8f8b-63947f4df16f/user"
}
},
"chapters": {
"links": {
"self": "/blog-posts/62a05bd2-2f0e-4bac-8f8b-63947f4df16f/relationships/chapters",
"related": "/blog-posts/62a05bd2-2f0e-4bac-8f8b-63947f4df16f/chapters"
}
}
}
}
}