Article ¶
Self-service articles, filterable by type, category and tags.
Show all of the records.GET/api/selfservice/article
Example URI
- type_id
integer(optional)The type of the articles.
- category_id
integer(optional)The category of the articles.
- tag_id
integer(optional)The tag associated with articles.
- include_subcategories
boolean(optional) Default: 0Include articles from subcategories of given category
- published
boolean(optional)Show published (1) articles or unpublished (0) articles only.
- protected
boolean(optional)Show protected (1) articles or unprotected (0) articles only.
- pinned
boolean(optional)If the article is pinned to show at the top on the frontend.
- start
integer(optional) Default: 1The first result to start from.
- limit
integer(optional) Default: 50The amount of results to fetch.
- order_column
string(optional) Default: idThe column to sort by.
- order_direction
string(optional) Default: ascThe ordering of the results.
200Headers
Content-Type: application/jsonBody
{
"status": "success",
"message": null,
"count": 1,
"data": [
{
"id": 1,
"author_id": 1,
"title": "Test Article",
"slug": "test-article",
"keywords": "test, article",
"excerpt": "This is an article",
"text": "An article for the masses.",
"positive_rating": 0,
"total_rating": 0,
"published": 1,
"published_at": 1446329199,
"protected": 0,
"pinned": 0,
"created_at": 1446329199,
"updated_at": 1446329199,
"frontend_url": "http://localhost/supportpal_v2/Announcements/article/test-article",
"categories": {
"0": {
"id": 1,
"type_id": 1,
"parent_id": null,
"name": "General",
"slug": "general",
"public": 1,
"parent_public": 1,
"created_at": 1449600034,
"updated_at": 1449600034,
"pivot": {
"article_id": 1,
"category_id": 1
}
},
"types": [
{
"id": 1,
"name": "Announcements",
"slug": "announcements",
"description": "View the latest news and announcements.",
"view": 1,
"icon": "...",
"show_on_dashboard": 1,
"created_at": 1445611905,
"updated_at": 1445611905,
"pivot": {
"article_id": 1,
"type_id": 1,
"views": 1
}
}
],
"tags": [
{
"id": 1,
"name": "Test",
"slug": "test",
"created_at": 1449599991,
"updated_at": 1449600099,
"pivot": {
"article_id": 1,
"tag_id": 1
}
}
],
"attachments": []
}
}
]
}Display the specified resource. Also can add a view to the article view counter.GET/api/selfservice/article/{id}
Example URI
- id
integer(required)The ID of the resource.
- type_id
integer(optional)The article type, recommended to include if you are trying to show the article for a known self-service type.
- increment_views: (boolean, optional) - Increment the article view count, requires the type_id.
string(required) Default: 0
200Headers
Content-Type: application/jsonBody
{
"status": "success",
"message": null,
"data": {
"id": 1,
"author_id": 1,
"title": "Test Article",
"slug": "test-article",
"keywords": "test, article",
"excerpt": "This is an article",
"text": "An article for the masses.",
"positive_rating": 0,
"total_rating": 0,
"published": 1,
"published_at": 1446329199,
"protected": 0,
"pinned": 0,
"created_at": 1446329199,
"updated_at": 1446329199,
"frontend_url": "http://localhost/supportpal_v2/Announcements/article/test-article",
"categories": {
"0": {
"id": 1,
"type_id": 1,
"parent_id": null,
"name": "General",
"slug": "general",
"public": 1,
"parent_public": 1,
"created_at": 1449600034,
"updated_at": 1449600034,
"pivot": {
"article_id": 1,
"category_id": 1
}
},
"types": [
{
"id": 1,
"name": "Announcements",
"slug": "announcements",
"description": "View the latest news and announcements.",
"view": 1,
"icon": "...",
"show_on_dashboard": 1,
"created_at": 1445611905,
"updated_at": 1445611905,
"pivot": {
"article_id": 1,
"type_id": 1,
"views": 1
}
}
],
"tags": [
{
"id": 1,
"name": "Test",
"slug": "test",
"created_at": 1449599991,
"updated_at": 1449600099,
"pivot": {
"article_id": 1,
"tag_id": 1
}
}
],
"attachments": []
}
}
}Store a newly created resource in storage.POST/api/selfservice/article
Example URI
- author_id
integer(required)The ID of the operator who has written this article.
- title
string(required)The title of the article. To add translations for the title, add title:locale, such as ‘title:en’, to the request to store a title for that given translation.
- slug
string(optional)The slug is the URL-friendly version of the title. It is usually all lowercase and contains only letters, numbers, and hyphens. To add translations, add slug:locale, such as ‘slug:en’, to the request.
- keywords
string(optional)Any keywords for the article, mainly used for SEO. To add translations for the keywords, add keywords:locale, such as ‘keywords:en’, to the request to store keywords for that given translation.
- excerpt
string(optional)An excerpt of the article, maximum 255 characters. To add translations for the excerpt, add excerpt:locale, such as ‘excerpt:en’, to the request to store an excerpt for that given translation.
- text
string(required)The article text. To add translations for the article text, add text:locale, such as ‘text:en’, to the request to store article text for that given translation.
- category
array(required)An array of category IDs to which the article belongs to.
- tag
array(optional)An array of tags for the article, use the full tag name and not IDs.
- published
boolean(optional) Default: 0If the article is published to users.
- published_at
integer(optional)Unix timestamp for the time that the article was published.
- protected
boolean(optional) Default: 0If only logged in users can view the article.
- pinned
boolean(optional) Default: 0If the article is pinned to show at the top on the frontend. Only applies to list view types.
Headers
Content-Type: application/x-www-form-urlencodedBody
author_id=1&title=Test+Article&excerpt=This+is+a+test+article+for+the+help+desk&text=This+is+a+test+article,+please+make+sure+this+is+right+before+publishing+it.&published=1&protected=0&category[]=1200Headers
Content-Type: application/jsonBody
{
"status": "success",
"message": "Successfully created new article!",
"data": {
"id": 1,
"author_id": 1,
"title": "Test Article",
"slug": "test-article",
"keywords": "test, article",
"excerpt": "This is an article",
"text": "An article for the masses.",
"positive_rating": 0,
"total_rating": 0,
"published": 1,
"published_at": 1446329199,
"protected": 0,
"pinned": 0,
"created_at": 1446329199,
"updated_at": 1446329199,
"frontend_url": "http://localhost/supportpal_v2/Announcements/article/test-article",
"categories": {
"0": {
"id": 1,
"type_id": 1,
"parent_id": null,
"name": "General",
"slug": "general",
"public": 1,
"parent_public": 1,
"created_at": 1449600034,
"updated_at": 1449600034,
"pivot": {
"article_id": 1,
"category_id": 1
}
},
"types": [
{
"id": 1,
"name": "Announcements",
"slug": "announcements",
"description": "View the latest news and announcements.",
"view": 1,
"icon": "...",
"show_on_dashboard": 1,
"created_at": 1445611905,
"updated_at": 1445611905,
"pivot": {
"article_id": 1,
"type_id": 1,
"views": 1
}
}
],
"tags": [
{
"id": 1,
"name": "Test",
"slug": "test",
"created_at": 1449599991,
"updated_at": 1449600099,
"pivot": {
"article_id": 1,
"tag_id": 1
}
}
],
"attachments": []
}
}
}422Headers
Content-Type: application/jsonBody
{
"status": "error",
"message": "The name field is required.",
"data": null
}Update the specified resource in storage. Including a translation for any relevant field will delete any existing translations that haven't been included in the request.PUT/api/selfservice/article/{id}
Example URI
- id
integer(required)The ID of the resource.
- author_id
integer(optional)The ID of the operator who has written this article.
- title
string(optional)The title of the article. To add translations for the title, add title:locale, such as ‘title:en’, to the request to store a title for that given translation.
- slug
string(optional)The slug is the URL-friendly version of the title. It is usually all lowercase and contains only letters, numbers, and hyphens. To add translations, add slug:locale, such as ‘slug:en’, to the request.
- keywords
string(optional)Any keywords for the article, mainly used for SEO. To add translations for the keywords, add keywords:locale, such as ‘keywords:en’, to the request to store keywords for that given translation.
- excerpt
string(optional)An excerpt of the article, maximum 255 characters. To add translations for the excerpt, add excerpt:locale, such as ‘excerpt:en’, to the request to store an excerpt for that given translation.
- text
string(optional)The article text. To add translations for the article text, add text:locale, such as ‘text:en’, to the request to store article text for that given translation.
- category
array(optional)An array of category IDs to which the article belongs to.
- tag
array(optional)An array of tags for the article, use the full tag name and not IDs.
- published
boolean(optional)If the article is published to users.
- published_at
string(optional)Unix timestamp for the time that the article was published.
- protected
boolean(optional)If only logged in users can view the article.
- pinned
boolean(optional)If the article is pinned to show at the top on the frontend. Only applies to list view types.
Headers
Content-Type: application/x-www-form-urlencodedBody
type_id=1&author_id=1&title=Test+Article&excerpt=This+is+a+test+article+for+the+help+desk&text=This+is+a+test+article,+please+make+sure+this+is+right+before+publishing+it.&published=1&protected=0&category[]=1200Headers
Content-Type: application/jsonBody
{
"status": "success",
"message": "Successfully updated the article!",
"data": {
"id": 1,
"author_id": 1,
"title": "Test Article",
"slug": "test-article",
"keywords": "test, article",
"excerpt": "This is an article",
"text": "An article for the masses.",
"positive_rating": 0,
"total_rating": 0,
"published": 1,
"published_at": 1446329199,
"protected": 0,
"pinned": 0,
"created_at": 1446329199,
"updated_at": 1446329199,
"frontend_url": "http://localhost/supportpal_v2/Announcements/article/test-article",
"categories": {
"0": {
"id": 1,
"type_id": 1,
"parent_id": null,
"name": "General",
"slug": "general",
"public": 1,
"parent_public": 1,
"created_at": 1449600034,
"updated_at": 1449600034,
"pivot": {
"article_id": 1,
"category_id": 1
}
},
"types": [
{
"id": 1,
"name": "Announcements",
"slug": "announcements",
"description": "View the latest news and announcements.",
"view": 1,
"icon": "...",
"show_on_dashboard": 1,
"created_at": 1445611905,
"updated_at": 1445611905,
"pivot": {
"article_id": 1,
"type_id": 1,
"views": 1
}
}
],
"tags": [
{
"id": 1,
"name": "Test",
"slug": "test",
"created_at": 1449599991,
"updated_at": 1449600099,
"pivot": {
"article_id": 1,
"tag_id": 1
}
}
],
"attachments": []
}
}
}404Headers
Content-Type: application/jsonBody
{
"status": "error",
"message": "The article with given ID was not found.",
"data": null
}Remove the specified resource from storage.DELETE/api/selfservice/article/{id}
Example URI
- id
integer(required)The ID of the resource.
200Headers
Content-Type: application/jsonBody
{
"status": "success",
"message": "Successfully deleted the article!",
"data": null
}Search for articles with a term.GET/api/selfservice/article/search
Example URI
- term
string(required)The query to use when searching for articles.
- type_id
integer(optional)If we want to limit it to a single type.
- brand_id
integer(optional)If we want to limit it to a single brand.
- published
boolean(optional) Default: 1If the article is published to users (one or more category must be visible).
- protected
boolean(optional) Default: 0Include protected (logged in users only) articles.
- order_column
string(optional) Default: idThe column to sort by.
- order_direction
string(optional) Default: ascThe ordering of the results.
- limit
integer(optional) Default: 10The amount of results to fetch.
Headers
Content-Type: application/x-www-form-urlencodedBody
term=test&brand_id=1200Headers
Content-Type: application/jsonBody
{
"status": "success",
"message": null,
"count": 1,
"data": [
{
"id": 1,
"author_id": 1,
"title": "Test Article",
"slug": "test-article",
"keywords": "test, article",
"excerpt": "This is an article",
"text": "An article for the masses.",
"positive_rating": 0,
"total_rating": 0,
"published": 1,
"published_at": 1446329199,
"protected": 0,
"pinned": 0,
"created_at": 1446329199,
"updated_at": 1446329199,
"frontend_url": "http://localhost/supportpal_v2/Announcements/article/test-article",
"categories": {
"0": {
"id": 1,
"type_id": 1,
"parent_id": null,
"name": "General",
"slug": "general",
"public": 1,
"parent_public": 1,
"created_at": 1449600034,
"updated_at": 1449600034,
"pivot": {
"article_id": 1,
"category_id": 1
}
},
"types": [
{
"id": 1,
"name": "Announcements",
"slug": "announcements",
"description": "View the latest news and announcements.",
"view": 1,
"icon": "...",
"show_on_dashboard": 1,
"created_at": 1445611905,
"updated_at": 1445611905,
"pivot": {
"article_id": 1,
"type_id": 1,
"views": 1
}
}
],
"tags": [
{
"id": 1,
"name": "Test",
"slug": "test",
"created_at": 1449599991,
"updated_at": 1449600099,
"pivot": {
"article_id": 1,
"tag_id": 1
}
}
],
"attachments": []
}
}
]
}422Headers
Content-Type: application/jsonBody
{
"status": "error",
"message": "The term field is required.",
"data": null
}Fetch related published articles (specific type only) for a term.GET/api/selfservice/article/related
Example URI
- term
string(required)The query to use when searching for related articles.
- type_id
integer(required)If we want to limit it to a single type.
- protected
boolean(optional) Default: 0Include protected (logged in users only) articles.
- limit
integer(optional) Default: 3The amount of results to fetch.
Headers
Content-Type: application/x-www-form-urlencodedBody
term=test&type_id=1200Headers
Content-Type: application/jsonBody
{
"status": "success",
"message": null,
"count": 1,
"data": [
{
"id": 1,
"author_id": 1,
"title": "Test Article",
"slug": "test-article",
"keywords": "test, article",
"excerpt": "This is an article",
"text": "An article for the masses.",
"positive_rating": 0,
"total_rating": 0,
"published": 1,
"published_at": 1446329199,
"protected": 0,
"pinned": 0,
"created_at": 1446329199,
"updated_at": 1446329199,
"frontend_url": "http://localhost/supportpal_v2/Announcements/article/test-article",
"categories": {
"0": {
"id": 1,
"type_id": 1,
"parent_id": null,
"name": "General",
"slug": "general",
"public": 1,
"parent_public": 1,
"created_at": 1449600034,
"updated_at": 1449600034,
"pivot": {
"article_id": 1,
"category_id": 1
}
},
"types": [
{
"id": 1,
"name": "Announcements",
"slug": "announcements",
"description": "View the latest news and announcements.",
"view": 1,
"icon": "...",
"show_on_dashboard": 1,
"created_at": 1445611905,
"updated_at": 1445611905,
"pivot": {
"article_id": 1,
"type_id": 1,
"views": 1
}
}
],
"tags": [
{
"id": 1,
"name": "Test",
"slug": "test",
"created_at": 1449599991,
"updated_at": 1449600099,
"pivot": {
"article_id": 1,
"tag_id": 1
}
}
],
"attachments": []
}
}
]
}422Headers
Content-Type: application/jsonBody
{
"status": "error",
"message": "The term field is required.",
"data": null
}Post a rating for article.POST/api/selfservice/article/{id}/rating
Example URI
- id
integer(required)The ID of the article.
- score
integer(required)Whether the article has been rated positively (1) or negatively (0).
- user_ip
string(required)The IP address of the user, only one vote per IP.
- user_id
integer(optional)If the rating is tied to a registered user, enter their user ID.
Headers
Content-Type: application/x-www-form-urlencodedBody
score=1&user_ip=192.168.0.1200Headers
Content-Type: application/jsonBody
{
"status": "success",
"message": "The article was successfully rated.",
"data": {
"id": 1,
"author_id": 1,
"title": "Test Article",
"slug": "test-article",
"keywords": "test, article",
"excerpt": "This is an article",
"text": "An article for the masses.",
"positive_rating": 1,
"total_rating": 2,
"published": 1,
"published_at": 1446329199,
"protected": 0,
"pinned": 0,
"created_at": 1446329199,
"updated_at": 1446329199
}
}422Headers
Content-Type: application/jsonBody
{
"status": "error",
"message": "The score field is required.",
"data": null
}
/api/selfservice/commentExample URI
integer(optional)The article that the comment was posted on.
integer(optional)The self-service type of the article that the comment was posted on.
integer(optional)The moderation status of the comment. 0 - Awaiting Moderation, 1 - Published, 2 - Spam.
integer(optional)The ID of the parent comment.
integer(optional)The ID of the root (upper most) parent comment.
integer(optional) Default: 1The first result to start from.
integer(optional) Default: 50The amount of results to fetch.
string(optional) Default: idThe column to sort by.
string(optional) Default: ascThe ordering of the results.
200Headers
Content-Type: application/jsonBody
{ "status": "success", "message": null, "count": 1, "data": [ { "id": 1, "article_id": 1, "type_id": 1, "author_id": 1, "text": "This is a comment!", "parent_id": null, "root_parent_id": null, "rating": 0, "status": 0, "notify_reply": 1, "created_at": 1446331613, "updated_at": 144633161 } ] }