News Posts
Return all News Posts.
Parameters
sortquery string
Sort ascending or descending order.
pagequery integer
Page offset to fetch.
per_pagequery integer
Number of results to return per page.
{
const res = await fetch(`${BASE_URL}/api/v1/news_posts`, {
method: 'GET',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(data)});
const data = await res.json();
}
{
"data": [
{
"id": "39e52f2d-b866-41ee-9591-4847e5f78afa",
"type": "news-posts",
"links": {
"self": "/news-posts/39e52f2d-b866-41ee-9591-4847e5f78afa"
},
"attributes": {
"url": "www.google.com",
"headline": "We're on 🔥 !\r\n\r\n\r\nThe second line of text",
"date": "2022-02-09"
}
},
{
"id": "ceac10cd-13de-40d1-a48c-d883624a1f46",
"type": "news-posts",
"links": {
"self": "/news-posts/ceac10cd-13de-40d1-a48c-d883624a1f46"
},
"attributes": {
"url": "https://business.staging.foodtekk.com/",
"headline": "Some Headline for the NEWS POST :)",
"date": "2022-02-22"
}
},
{
"id": "b0b18ae5-47f7-4d74-98f0-f5d237fe9555",
"type": "news-posts",
"links": {
"self": "/news-posts/b0b18ae5-47f7-4d74-98f0-f5d237fe9555"
},
"attributes": {
"url": "https://www.google.com",
"headline": "This is 🎉",
"date": "2022-02-02"
}
}
],
"meta": {
"total-count": 13,
"total-pages": 5
}
}
News Post by id
Return a News Post.
Parameters
idpath integerRequired
Return a News Post by specific
id
.
{
const res = await fetch(`${BASE_URL}/api/v1/news_posts/${id}`, {
method: 'GET',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(data)});
const data = await res.json();
}
{
"data": {
"id": "39e52f2d-b866-41ee-9591-4847e5f78afa",
"type": "news-posts",
"links": {
"self": "/news-posts/39e52f2d-b866-41ee-9591-4847e5f78afa"
},
"attributes": {
"url": "www.google.com",
"headline": "We're on 🔥 !\r\n\r\n\r\nThe second line of text",
"date": "2022-02-09"
}
}
}