API Documentation

Purpose

This document outlines the API methods available, the parameters they receive and the results returned. The objective is to give an overall view of the possibilities available for integration with the Answerbase System.

API Structure: REST

The API is organized based on principles of Representational State Transfer (REST). All the methods are invoked via an HTTP Request implementing HTTP authentication and HTTP verbs and are answered by appropriate HTTP Status code and (when required) a result as either JSON or XML.

The base subdomain of the API is: https://xxxx.services.answerbase.com, where the xxxx represents your sitename. You can look up the exact subdomain in your admin site under Customization > API.

Authentication

All API methods require an OAuth 2.0 authorization token to be attached in the HTTP request header (to see how to obtain the token, see get token method description). The token should be included as Authorization parameter, with value set to "token_type access_token" (the type of token and the token itself, separated with space).

Example:

request.addHeader("authorization", "bearer test_SjT-ovlgrq92voBba-g4P")

All the API calls have to be made over HTTPS. A call made over HTTP or not containing a token will fail.

Http Status Codes

The API returns an appropriate HTTP status code for every request:

  • 200 OK -- This status code will be returned when a successful request has been made.
  • 201 Created -- This status code indicates that the request has succeeded and has led to the creation of a resource.
  • 400 Bad Request -- This status code will be returned if there is an issue with the submitted data. An error message will also be included in the response.
  • 401 Not Authorized -- This status code will be returned if the API request:
    • Contained no token
    • Contained invalid token
    • Contained expired token
  • 429 Too Many Requests -- This status code will be returned if the API request exeded the maximum allowed requests.
  • 500 Internal Server Error -- This status code will be returned if there is an error with the API.

For a list of all possible status codes, please use this reference.

Parameters

Encoding

All data should be UTF-8 encoded.

Content-Type

When making POST/PUT requests, you must include the following HTTP header:

Content-Type: application/x-www-form-urlencoded

Unless one of the parameters is of type file, in which case you must include:

Content-Type: multipart/form-data

Currently, application/json is not supported.

Dates

All dates are passed and returned in the following format: m/d/y h:M:s

ex: 9/27/2008 9:35:47

Note: The times are expressed in client's local time zone

Format

The results are returned in JSON (default) or XML. You can use HTTP "Accept" header to specify the required format

Example:

request.addHeader("accept", "application/json")
request.addHeader("accept", "application/xml")
Alternatively, "format" parameter can be added to the URL

Example:
http://clientanswerssite.com/api/vX/answers/1?format=json
http://clientanswerssite.com/api/vX/answers/1?format=xml 

Errors and wrapping

Generally, if a result couldn't be retrieved from the API, a corresponding HTTP error code is issued together with an explanation (if any available).

For example, if a request contained no token, a following response would be issued:

401 Unauthorized
{
"message": "Authorization has been denied for this request."
}
Upon request, response wrapping is also available. By adding "wrap=true" parameter an "200 OK" response envelope will be returned together with either the result or error list, e.g. for the example above:
200 OK
{
"statusCode": 401,
"errors": [
    "Unauthorized",
    "Authorization has been denied for this request."
],
"result": null
}

General Notes

Categories and Tags

In the administration site of your Answerbase Q&A site you have the feature preference option to choose whether you want to use “categories” or “tags” in your site. There are a range of methods that accept both "categories" and "tags" as parameters, but depending on your preference setting, only one of these will be relevant for your site. Likewise many methods can return both <categories> and <tags> and while for consistency both of those xml nodes are always returned, only the relevant one for your site is populated with data.

User Identifiers

Many of the API methods take a user identifier as one of the input parameters. Depending on the type of the id is to be used, one of the parameters listed below should be specified within the request:

Name Data Type Description
username string Answerbase's internal, unique user name
userid int Answerbase's internal, unique user id (also available in the administration site)
useremail string Asnwerbase's user email
sso_userid string refers to sites that have Single Sign On integration and need to pass their own unique id to identify users in the Answerbase site

Data Objects

The following are common data objects and their json/xml structure that the API methods return. In the methods described further below, these common objects are just referenced by their name, i.e. [Short Question].

Question Core


    [
    id                  :int
    answersCount        :int
    followerCount       :int
    url                 :string
    publicationTime     :datetime
    lastUpdateTime      :datetime
    latestAnswerTime    :datetime
    status              :{open|closed}
    type                :{public|private}
    title               :title
    details             :string
    user                :user core
    topanswer           :answer
    categories          [:category]
    tags                [:tag]
    product             :product
    externalurl         :string
    urlslug             :string
    metatitle           :string
    metadescription     :string
    metakeywords        :string
    index               :bool
    follow              :bool
    includeinsitemap    :bool
    canonical           :string
    locked              :bool
    ]
Example

JSON
{
    "title": "What are routers?",
    "id": 2530123,
    "details": "I don't know what the word refers to",
    "answersCount": 1,
    "followerCount": 3,
    "url": "https://abc.answerbase.com/2530123/What-are-routers",
    "status": "closed",
    "publicationtime": "Oct 22, 2018 - 12:39 PM",
    "latestAnswertime": "Oct 22, 2018 - 12:39 PM",
    "type": "public",
    "user":
        {
            "username": "admin",
            "id": 2040897,
            "sso_userid": "",
            "displayName": "admin",
            "firstname": "",
            "lastname": "",
            "points": 0,
            "totalRank": "1",
            "profileUrl": null
        },
    "categories": [
        {
            "name": "Power Tools, 14",
            "id": 818040,
            "externalId": "14",
            "url": "https://abc.answerbase.com/Topic/Power-Tools/818040",
            "questionscount": 13,
            "childCategories": []
        }
    ],
    "tags": [],
    "product": null,
    "comments": null,
    "topAnswer": null,
    "externalurl": null,
    "urlslug": "What-are-routers",
    "metatitle": "What are routers?",
    "metadescription": "What a router is and how it is used to connect computers",
    "metakeywords": "Router, packet, network, LAN, WAN",
    "index": true,
    "follow": true,
    "includeinsitemap": true,
    "canonical": "https://abc.answerbase.com/2530123/What-are-routers",
    "locked": false,
}

Question


    [
    id                  :int
    answersCount        :int
    followerCount       :int
    url                 :string
    publicationTime     :datetime
    lastUpdateTime      :datetime
    latestAnswerTime    :datetime
    status              :{open|closed}
    type                :{public|private}
    title               :title
    details             :string
    user                :user core
    answers             [:answer]
    categories          [:category]
    tags                [:tag]
    product             :product
    attachments         [:attachment]
    comments            [:comment]
    relatedContentList  [:relatedContent]
    externalurl         :string
    urlslug             :string
    metatitle           :string
    metadescription     :string
    metakeywords        :string
    index               :bool
    follow              :bool
    includeinsitemap    :bool
    canonical           :string
    locked              :bool
    ]
Example

JSON
{
    "title": "pop ceiling how much cost 12*10",
    "id": 2746864,
    "details": "POP Ceilings Design,174975,All India,DIR",
    "answersCount": 1,
    "followerCount": 13,
    "url": "https://abc.answerbase.com/2746864/pop-ceiling-how-much-cost-12-10",
    "status": "closed",
    "publicationtime": "May 16, 2019 - 06:46 PM",
    "latestAnswertime": "May 16, 2019 - 06:48 PM",
    "type": "public",
    "user": 
        {
            "username": "86217019",
            "id": 2205889,
            "sso_userid": "",
            "displayName": "",
            "firstname": "",
            "lastname": "",
            "points": 0,
            "totalRank": "",
            "profileUrl": null
        },
    "attachments": [],
    "categories": [
        {
            "name": "POP Ceiling Work",
            "id": 944370,
            "externalId": "164287",
            "url": "https://abc.answerbase.com/Topic/POP-Ceiling-Work/944370",
            "questionscount": 3,
            "childCategories": []
        }
    ],
    "tags": [],
    "product": null,
    "comments": [],
    "topAnswer": null,
    "answers": [
        {
        "id": 2746867,
        "text": "7200<br /><br />Answered By : <a href=
                "https://www.mart.com/senseofstyle/">Sense Of Style</a>",
        "published": "true",
        "publicationTime": "May 16, 2019 - 06:48 PM",
        "isBestAnswer": "false",
        "goodVotes": 0,
        "badVotes": 0,
        "source": null,
        "user": 
            {
                "username": "category_k",
                "id": 2048719,
                "sso_userid": "",
                "displayName": "Jim",
                "firstname": "",
                "lastname": "",
                "points": 0,
                "totalRank": "3",
                "profileUrl": null
            },
        "questionId": 2746864,
        "attachments": [],
        "comments": []
        }
    ],
    "relatedContentList": [
        {
            "id": 349610,
            "title": "How to boost my sales",
            "url": "https://sellingpower.com/10-tips-to-improve-your-sales",
            "viewCount": 0,
            "clickCount": 0,
            "clickRate": 0.0
        }
    ],
    "externalurl": null,
    "urlslug": "What-are-routers",
    "metatitle": "What are routers?",
    "metadescription": "What a router is and how it is used to connect computers",
    "metakeywords": "Router, packet, network, LAN, WAN",
    "index": true,
    "follow": true,
    "includeinsitemap": true,
    "canonical": "https://abc.answerbase.com/2530123/What-are-routers",
    "locked": false,
}
    

Answer


[
    id              :int
    text            :string
    published       :bool
    publicationTime :datetime
    isBestAnswer    :bool
    goodVotes       :int
    badVotes        :int
    source          :string
    user            :user core
    questionId      :int
    attachments     [:attachment]
    comments        [:comment]
]
Example

JSON
{
    "id": 2752187,
    "text": "This Digital Download card is something that needs to be shipped out 
                to you. We do not have the songs available for instant download at 
                this time.",
    "published": "true",
    "publicationTime": "Jul 02, 2019 - 11:29 AM",
    "isBestAnswer": "false",
    "goodVotes": 2,
    "badVotes": 0,
    "source": null,
    "user": 
        {
            "username": "Robin",
            "id": 2216272,
            "sso_userid": "6134b233-4c2d-4b2d-9f4a-47f58f4a216e",
            "displayName": "Robin",
            "firstname": "",
            "lastname": "",
            "points": 0,
            "totalRank": "",
            "profileUrl": null
        },
    "questionId": 2752186,
    "attachments": [],
    "comments": []
}

Attachment

[
    name            :string
    fileurl         :string
]
Example
JSON
{
    "name": "Grand Canyon"
    "fileurl": "http://abc.answerbase.com/canyon.jpg"
}

Comment

[
    id              :id
    text            :string
    published       :bool
    publicationDate :datetime
    goodVotes       :int
    user            :user core
    relatedPost     :relatedPost
]
Example

JSON
{
    "text": "Can you please clarify?",
    "id": 2752200,
    "published": "true",
    "publicationDate": "Oct 04, 2019 - 11:36 PM",
    "goodVotes": 0,
    "user": 
        {
            "username": "lumin",
            "id": 201,
            "sso_userid": "",
            "displayName": "lumin",
            "firstname": "",
            "lastname": "",
            "points": 50,
            "totalRank": "",
            "profileUrl": null
        },
    "relatedPost": 
        {
            "id": 2752038,
            "url": "https://abc.answerbase.com/2752038/test-33",
            "type": "question"
        }
}

User Core

[
    username            :string
    id                  :int
    sso_userid          :string
    displayName         :string
    firstname           :string
    lastname            :string
    points              :int (earned within the specific timeframe and categories)
    totalRank           :int
    profileUrl          :string
]
Example

JSON:
{
    "username": "david",
    "id": 4,
    "sso_userid": "xy878",
    "displayName": "goliath",
    "firstname": "David",
    "lastname": "Martinez",
    "points": 60,
    "totalRank": 5,
    "profileUrl": "http://abc.answerbase.com/david"
}

User

[
    username            :string
    id                  :int
    sso_userid          :string
    displayName         :string
    firstname           :string
    lastname            :string
    title               :string
    organization        :string
    website             :string
    address             :string
    city                :string
    region              :string
    country             :string
    profileEmail        :string
    homeNumber          :string
    officeNumber        :string
    mobileNumber        :string
    faxNumber           :string
    facebookUrl         :string
    twitterUrl          :string
    linkedInUrl         :string
    googleUrl           :string
    points              :int    (total points earned, in some cases within the 
                                specific timeframe and categories specified)
    totalRank           :int
    questionsAnswered   :string
    staffexpert         :string
    imageUrl            :string
    profileUrl          :string
    askQuestionUrl      :string
    topCategories       :string
    topTags             :string
    aboutMe             :string
    customFields        [:customField]
    acceptsPromotionalEmails: bool
]
Examples
JSON:
{
    "username": "betty",
    "id": 202,
    "sso_userid": "",
    "displayName": "betty",
    "firstname": "",
    "lastname": "",
    "points": 50,
    "totalRank": "",
    "profileUrl": "http://abc.answerbase.com/Profile/betty/"
    "title": "",
    "organization": "",
    "aboutMe": "",
    "website": "",
    "address": "",
    "city": "",
    "region": "",
    "country": "",
    "profileEmail": "",
    "homeNumber": "",
    "officeNumber": "",
    "mobileNumber": "",
    "faxNumber": "",
    "facebookUrl": "",
    "twitterUrl": "",
    "linkedInUrl": "",
    "googleUrl": "",
    "customFields": [],
    "questionsAnswered": 12,
    "staffexpert": "true",
    "imageUrl": "https://abc.answerbase.com/images/Avatars/avatar_01.jpg",
    "askQuestionUrl": "https://abc.answerbase.com/ask?expertId=202",
    "topCategories": "Support",
    "topTags": "",
    "acceptsPromotionalEmails": "true"
}

Category

[
    name                :string
    id                  :int
    externalId          :string
    url                 :string
    questionscount      :int
    childCategories     :[:category]
]
Examples
JSON
{
    "name": "Power Tools",
    "id": 818040,
    "externalId": "14",
    "url": "https://abc.answerbase.com/Topic/Power-Tools/818040",
    "questionscount": 13,
    "childCategories": [
    {
        "name": "Black & Decker Power Tools",
        "id": 991183,
        "externalId": "182950",
        "url": "https://abc.answerbase.com/Topic/Black-Decker-Power-Tools/991183",
        "questionscount": 0,
        "childCategories": []
    },
    {
        "name": "Bosch Power Tools",
        "id": 991176,
        "externalId": "180538",
        "url": "https://abc.answerbase.com/Topic/Bosch-Power-Tools/991176",
        "questionscount": 0,
        "childCategories": []
    }
    ]
}

Tag

[
    name                :string
    id                  :int
    externalId          :string
    url                 :string
    questionscount      :int
]
Examples
JSON
{
    "name": "Advice",
    "id": 818041,
    "externalId": "147",
    "url": "https://abc.answerbase.com/Topic/Advice/818041",
    "questionscount": 6
}

Product


    [
    name                :string
    id                  :int
    sku                 :string
    imageurl            :string
    questioncount       :int
    price               :decimal
    description         :string
    category            [:category]
    ]
Examples
JSON
{
    "name": "Digital Manuals: Spanish Edition",
    "id": 115158,
    "sku": "978149089",
    "url": "https://products.onlineshop.com/product/9781470739089-digital-vbs-leader-manuals-spanish.do?sortby=priceAscend&page=2&refType=&from=fn",
    "imageurl": "https://cdn.yourzoom.com/gp/9781470739089/9781470739089.yz/large.jpg",
    "questioncount": 0,
    "price": 0.0,
    "description": "Digital Leader Manuals: Spanish Edition",
    "category": null
}

Related Content

[
    id                  :int
    url                 :string
    title               :string
    viewCount           :int
    clickCount          :int
    clickRate           :decimal
]
Example
JSON
{
    "id": 349610,
    "title": "How to boost my sales",
    "url": "https://sellingpower.com/10-tips-to-improve-your-sales-performance",
    "viewCount": 20,
    "clickCount": 0,
    "clickRate": 0.0
}

Related Post

[
    id                  :int
    url                 :string
    type                :string
]
Example
JSON
{
    "id": 2752038,
    "url": "https://abc.answerbase.com/2752038/test-33",
    "type": "question"
}

Token

[
    access_token    :string
    token_type      :string
    expires_in      :int (seconds)
]

Note: This object is returned as JSON only, XML format is not available

Examples
JSON
{
    "access_token": "test_SjT-ovlgrq92vFtr2qo0zPjNmpLN7tyo9znoBba",
    "token_type": "bearer",
    "expires_in": 86399
}

Questions

Get question

Gets a question with specified ID

GET /api/v2/questions/:id

Parameters

Name Data Type Mandatory Description
id int Y Question ID (from URL)
includeUnpublishedAnswers bool N Should unpublish answers to the question be listed (true/false, default: false)
includeUnpublishedComments bool N Should unpublish comments to the question be listed (true/false, default: false)

Sample request

GET /api/v2/questions/100?includeUnpublishedComments=true

Response

An question object.

Get question list

Gets a list of questions based on a range of parameters

GET /api/v2/questions/list

Parameters

Name Data Type Mandatory Description
categories
categoryIds
categoryExternalIds
string
string
string
N
(Provide one of the three parameters)
One or more category names, separated by commas.
One or more category IDs, separated by commas.
One or more category external IDs, separated by commas.
tags
tagIds
tagExternalIds
string
string
string
N
(Provide one of the three parameters)
One or more tag names, separated by commas.
One or more tag IDs, separated by commas.
One or more tag external IDs, separated by commas.
productsku string N SKU of the related product
productexternalid string N The External Id of the related product
username
sso_userid
userid
useremail
string
string
string
string
N
(Provide one of the four parameters)
Filters by the author of the questions. Username, userid and useremail are the Answerbase values, sso_userid is the clients own userid
keywords string N Can be a single keyword or a group of keywords. The keywords will be searched for within the question title and description.
closed bool N (true/false, default: false)
postType string N “public”/“private” (default: "public")
withanswers bool N (true/false)
withstaffanswers bool N (true/false)
featured bool N (true/false)
contentUrl string N Identify the related content URL to pull questions associated with that specific URL through the “Related Content” features.
questionIds string N One or more question IDs, separated by a comma
fullquestiondetails bool N "true"/"false". If "true", returns full details of each question including the question as well as all answers, comments and attachments (default: "false")
includeUnpublishedAnswers bool N Should unpublish answers to the question be listed (true/false, default: false)
includeUnpublishedComments bool N Should unpublish comments to the question be listed (true/false, default: false)
microcontent bool N Identifies whether to get only content that has been identified as supplementary content
startindex int N The starting element to be returned (useful for paging). 0 = the first element
maxresults string N The maximum amount of results returned. 0 = all results.
includeSubcategories bool N if "false" only questions associated directly with the category will be returned otherwise all questions associated with the category and it's subcategories will be returned. (true/false, default: true)
orderby string N Value options:
“newest”: sorts with the newest published questions first.
“toprated”: sorts the questions based on the amount of votes the answers have received. The highest amount of votes is first.
“closetime”: sorts with the most recently closed questions first.
“mostpopular”: sorts by number of views all time with the highest first.
“recentlypopular”: sorts by number of views within the last 30 days with the highest first.
“recentlyactive”: sorts with the most recently active questions first (where active means having comments or answers published).
“recentlyanswered”: sorts with the most recently answered questions first.
submittedAfterDate datetime N The date after which the question was submitted. Format: YYYY-MM-DD
publishedAfterDate datetime N The date after which the question was published. Format: YYYY-MM-DD

Sample request

GET /api/v2/questions/list?keywords=best pizza&withanswers=true

Response

A list of question core objects.

Get questions for autosuggest

Returns a list of questions similar to the question typed passed. This method uses the search index, not the database directly, and takes into account similarities, typing errors, keyword proximity etc.

GET /api/v2/questions/autosuggest

Parameters

Name Data Type Mandatory Description
query string Y The question that is being typed
categoryId string N
productId string N

Sample request

GET /api/v2/questions/autosuggest?query=how long time does the shipping take?

Response

JSON
{
    "query": "asking a question with attachments?",
    "suggestions": [
        "how to order",
        "new guest post 2309uoi"
    ],
    "data": [
        "https://abc.qa.answerbase.com/68575/how-to-order",
        "https://abc.qa.answerbase.com/68587/new-guest-post-2309uoi"
    ]
}
        

Get deleted

Returns a list of question ids for questions that have been deleted.

GET /api/v2/questions/getdeleted

Parameters

Name Data Type Mandatory Description
deletedsincedate datetime Y The date since which the questions have been deleted

Sample request

GET /api/v2/questions/getdeleted?deletedsincedate=2019-01-01

Response

JSON
{
    "totalCount": 3240,
    "questionIds": [
        {
            "deletetime": "2019-01-02T01:24:22",
            "id": 2578345
        },
        {
            "deletetime": "2019-01-03T00:56:56",
            "id": 2588625
        },
        {
            "deletetime": "2019-01-03T06:16:22",
            "id": 2589551
        }
    ]
}

Get by user

Returns a list of questions asked, answered, visited etc. by the user

GET /api/v2/questions/getbyuser

Parameters

Name Data Type Mandatory Description
username
sso_userid
userid
useremail
string
string
string
string
Y
(Provide one of the four parameters)
Filters by the author of the questions. Username, userid and useremail are the Answerbase values, sso_userid is the clients own userid
type string N Value options:
“asked”: questions asked by the user (this is default).
“askedto”: questions asked directly to the user.
“questionscommented”: questions commented by the user.
“questionsfollowed”: questions followed by the user.
“answeredby”: questions answered by the user.
“highestratedanswers”: questions with highest rated answers by the user.
“viewedby”: questions viewed by the user.
fullquestiondetails bool N "true"/"false". If "true", returns full details of each question including the question as well as all answers, comments and attachments (default: "false")
maxresults string N The maximum amount of results returned. 0 = all results.

Sample request

GET /api/v2/questions/getbyuser?userid=202&type=viewedby

Response

A list of question core objects.

Ask question

Allows a question to be submitted to the application.

POST /api/v2/questions/ask

Input

Name Data Type Mandatory Description
title string Y The question title text (max. 150 characters)
(user identifier) user identifier Y The author of the question. Use any of valid identifier parameters
details string N The question body text
type string N public/private
expertaskedId int N The expert’s ID in Answerbase
externalurl string N For sites using Answerbase via API only, this can be set so that notifications going out, lead the users to the correct question url.
publishdatetime datetime N The specific time the question was posted.
categories
categoryIds
categoryExternalIds
string
string
string
N
(Provide one of the three parameters)
One or more category names, separated by commas.
One or more category IDs, separated by commas.
One or more category external IDs, separated by commas.
tags
tagIds
tagExternalIds
string
string
string
N
(Provide one of the three parameters)
One or more tag names, separated by commas.
One or more tag IDs, separated by commas.
One or more tag external IDs, separated by commas.
productsku string N SKU of the related product
productexternalid string N Externalid of the related product
attachments file N Files related to the answer (read from multipart/mime request)
sourceType int N The source the question was posted from. The value has to be an integer: Desktop = 1, Mobile = 2

Sample request

POST /api/v2/questions/
{
"title": "How can it be done?",
"username": "testuser"
}

Response

JSON
{
    "id"     :"99999",
    "url"    :"",
}

Update question

Allows a question to be updated.
Note that the categories/tags passed replace the existing associated categories/tags, so they need to be passed even if they aren't updated as otherwise they will be removed from the question.

PUT /api/v2/questions/:id

Input

Name Data Type Mandatory Description
title string N The question title text (max. 150 characters)
(user identifier) user identifier N The author of the modification. Use any of valid identifier parameters
details string N The question body text
type string N public/private
externalurl string N For sites using Answerbase via API only, this can be set so that notifications going out, lead the users to the correct question url.
publishdatetime datetime N The specific time the question was posted.
categories
categoryIds
categoryExternalIds
string
string
string
N
(Provide one of the three parameters)
One or more category names, separated by commas.
One or more category IDs, separated by commas.
One or more category external IDs, separated by commas.
tags
tagIds
tagExternalIds
string
string
string
N
(Provide one of the three parameters)
One or more tag names, separated by commas.
One or more tag IDs, separated by commas.
One or more tag external IDs, separated by commas.
productsku string N SKU of the related product
closed bool N Change the open/close status of the question (true/false)

Sample request

PUT /api/v2/questions/100
{
"closed": "true"
}

Response

Empty (Check HTTP code for status).

Follow question

Allows a user to follow the specified question.

PUT /api/v2/questions/:id/follow

Input

Name Data Type Mandatory Description
id int Y Question ID (from URL)
(user identifier) user identifier Y Any of valid identifier parameters

Sample request

PUT /api/v2/questions/100/follow
{
"username": "testuser"
}

Response

Empty (Check HTTP code for status).

Unfollow question

Allows a user to unfollow the specified question.

PUT /api/v2/questions/:id/unfollow

Input

Name Data Type Mandatory Description
id int Y Question ID (from URL)
(user identifier) user identifier Y Any of valid identifier parameters

Sample request

PUT /api/v2/questions/100/unfollow
{
    "username": "testuser"
}

Response

Empty (Check HTTP code for status).

Report question

Flags a question for review

PUT /api/v2/questions/:id/report

Input

Name Data Type Mandatory Description
id int Y Question ID (from URL)
(user identifier) user identifier Y Any of valid identifier parameters

Sample request


    PUT /api/v2/questions/100/report
    {
    "username" : "testuser"
    }

Response

Empty (check HTTP code for status).

Answers

Get answer

Gets an answer with specified ID

GET /api/v2/answers/:id

Parameters

Name Data Type Mandatory Description
id int Y Answer ID (from URL)
includeUnpublishedComments bool N Should unpublish comments to the answer be listed (true/false, default: false)

Sample request

GET /api/v2/answers/100?includeUnpublishedComments=true

Response

An answer object.

Add answer

Adds a new answer

POST /api/v2/answers/add

Input

Name Data Type Mandatory Description
questionId int Y ID of the question that answer refers to
(user identifier) user identifier Y Any of valid identifier parameters
answer string Y Answer text
source string N Answer source text
staffAnswer bool N Is the answer provided by a staff member (true/false)
attachments file N Files related to the answer (read from multipart/mime request)
sourceType int N The source the question was posted from. The value has to be an integer: Desktop = 1, Mobile = 2

Sample request

POST /api/v2/answers/
{
"questionId": "1",
"username": "testuser"
"answer": "That should be Central Perk!"
}

Response

A newly created answer object.

Update answer

Updates given fields of an answer

PUT /api/v2/answers/:id

Input

Name Data Type Mandatory Description
id int Y Answer ID (from URL)
(user identifier) user identifier N Any of valid identifier parameters
answer string N Answer text
source string N Answer source text
staffAnswer bool N Is the answer provided by stuff member (true/false)
published bool N Should the answer be published directly (true/false)
selectAsBest bool N Should the answer be marked as best (true, cannot be undone)

Sample request

PUT /api/v2/answers/100
{
"answer" : "No spelling mistakes this time!",
"published" : "true"
}

Response

Empty (Check HTTP code for status).

Report answer

Flags an answer for review

PUT /api/v2/answers/:id/report

Input

Name Data Type Mandatory Description
id int Y Answer ID (from URL)
(user identifier) user identifier Y Any of valid identifier parameters

Sample request

PUT /api/v2/answers/100/report
{
"username" : "testuser"
}

Response

Empty (check HTTP code for status).

Vote for answer

Allows a user to vote for an answer

PUT /api/v2/answers/:id/vote/:score

Input

Name Data Type Mandatory Description
id int [FROM URL] Y Answer ID
rating int [FROM URL] Y Answer's rating (only "-1" or "1" values are accepted)
(user identifier) user identifier Y Any of valid identifier parameters

Sample request

PUT /api/v2/answers/100/vote/1
{
"username" : "testuser"
}

Response

Empty (check HTTP code for status).

Users

Get user

Gets a user with the specified id

GET /api/v2/users/get

Parameters

Name Data Type Mandatory Description
username
sso_userid
userid
useremail
string
string
string
string
N
(Provide one of the four parameters to identify the user)
Username, userid and useremail are the Answerbase values, sso_userid is the clients own userid

Sample request

GET /api/v2/users/get?userid=202

Response

A user object.

Get user list

Gets a list of users based on a range of parameters

GET /api/v2/users/list

Parameters

Name Data Type Mandatory Description
keywords string N Can be a single keyword or a group of keywords. The keywords will be searched for within the question title and description.
startindex int N The starting element to be returned (useful for paging). 0 = the first element
maxresults string N The maximum amount of results returned. 0 = all results.

Sample request

GET /api/v2/users/list?keywords=betty

Response

A list of user objects.

Get staff experts

Gets a list of users who are defined as staff experts

GET /api/v2/users/staffexperts

Parameters

Name Data Type Mandatory Description
categories
categoryIds
categoryExternalIds
string
string
string
N
(Provide one of the three parameters)
One or more category names, separated by commas.
One or more category IDs, separated by commas.
One or more category external IDs, separated by commas.
tags
tagIds
tagExternalIds
string
string
string
N
(Provide one of the three parameters)
One or more tag names, separated by commas.
One or more tag IDs, separated by commas.
One or more tag external IDs, separated by commas.
maxresults string N The maximum amount of results returned. 0 = all results.

Sample request

GET /api/v2/users/staffexperts?categoryIds=322

Response

A list of user objects.

Get featured expert

Returns a random featured expert related to at least one of the categories passed. If no categories are specified, then the expert will be chosen from the entire pool of featured experts.

GET /api/v2/users/featuredexpert

Parameters

Name Data Type Mandatory Description
categories
categoryIds
categoryExternalIds
string
string
string
N
(Provide one of the three parameters)
One or more category names, separated by commas.
One or more category IDs, separated by commas.
One or more category external IDs, separated by commas.
tags
tagIds
tagExternalIds
string
string
string
N
(Provide one of the three parameters)
One or more tag names, separated by commas.
One or more tag IDs, separated by commas.
One or more tag external IDs, separated by commas.

Sample request

GET /api/v2/users/featuredexpert?categoryIds=309

Response

A user object.

Get top experts

Returns the experts that earned most points within the specified parameters. If no parameters are specified, the overall top experts are returned. The experts are sorted by highest points first.

GET /api/v2/users/topexperts

Parameters

Name Data Type Mandatory Description
categories
categoryIds
categoryExternalIds
string
string
string
N
(Provide one of the three parameters to identify the user)
One or more category names, separated by commas.
One or more category IDs, separated by commas.
One or more category external IDs, separated by commas.
tags
tagIds
tagExternalIds
string
string
string
N
(Provide one of the three parameters)
One or more tag names, separated by commas.
One or more tag IDs, separated by commas.
One or more tag external IDs, separated by commas.
fromdate datetime N
todate datetime N
featured bool N
startindex string N The starting element to be returned (useful for paging). 0 = the first element.
maxresults string N The maximum amount of results returned. 0 = all results.

Sample request

GET /api/v2/users/topexperts?categoryIds=309

Response

A user object.

Get user point summary

Gets the summary of points earned for the user with the specified id

GET /api/v2/users/get/pointsummary

Parameters

Name Data Type Mandatory Description
username
sso_userid
userid
useremail
string
string
string
string
N
(Provide one of the four parameters to identify the user)
Username, userid and useremail are the Answerbase values, sso_userid is the clients own userid

Sample request

GET /api/v2/users/get/pointsummary?userid=202

Response

JSON
{
    "username": "betty",
    "totalPoints": 3039,
    "thumbUpPoints": 0,
    "bestAnswerPoints": 25,
    "askQuestionPoints": 8,
    "answerQuestionPoints": 0,
    "votingPoints": 5,
    "systemPoints": 2876
}

Get user subscriptions

Returns the list of categories, tags or products that the user is subscribed to.

GET /api/v2/users/get/subscriptions

Parameters

Name Data Type Mandatory Description
username
sso_userid
userid
useremail
string
string
string
string
N
(Provide one of the four parameters to identify the user)
Username, userid and useremail are the Answerbase values, sso_userid is the clients own userid

Sample request

GET /api/v2/users/get/subscriptions?userid=202

Response

JSON
{
    "username"          :"betty",
    "categories"        [:category],
    "tags"              [:tag],
    "products"          [:product]
    "subscribedToAll"   :bool
}

Add user subscription

Creates a subscription to the category, tag or product specified.

POST /api/v2/users/addsubscription

Parameters

s
Name Data Type Mandatory Description
username
sso_userid
userid
useremail
string
string
string
string
N
(Provide one of the four parameters to identify the user)
Username, userid and useremail are the Answerbase values, sso_userid is the clients own userid
category
categoryId
categoryExternalId
string
string
string
N
(Provide one of the three parameters)
category name
category ID.
category external ID
tag
tagId
tagExternalId
string
string
string
N
(Provide one of the three parameters)
tag name
tag ID
tag external ID
productId
productExternalId
productSKU
string
string
string
N
(Provide one of the three parameters)
product Id
product external ID
product SKU unique identifier
SubscribeToAll bool
N Set to "true" if you want to subscribe to notifications for ALL categories, tags or products.

Sample request

POST /api/v2/users/addsubscription

Response

Empty (Check HTTP code for status).

Remove user subscription

Removes a subscription to the category, tag or product specified.

POST /api/v2/users/removesubscription

Parameters

Name Data Type Mandatory Description
username
sso_userid
userid
useremail
string
string
string
string
N
(Provide one of the four parameters to identify the user)
Username, userid and useremail are the Answerbase values, sso_userid is the clients own userid
category
categoryId
categoryExternalId
string
string
string
N
(Provide one of the three parameters)
category name
category ID.
category external ID
tag
tagId
tagExternalId
string
string
string
N
(Provide one of the three parameters)
tag name
tag ID
tag external ID
productId
productExternalId
productSKU
string
string
string
N
(Provide one of the three parameters)
product Id
product external ID
product SKU unique identier
SubscribeToAll bool
N Set to "false" if you want to unsubscribe to notifications for ALL categories, tags or products.

Sample request

POST /api/v2/users/removesubscription

Response

Empty (Check HTTP code for status).

Register user

Allows a user to be registered in the application.
Note: If you submit a username and an email address that already exists for an existing user, a new user is not created, but the existing user id returned instead.

POST /api/v2/users

Input

Name Data Type Mandatory Description
username string Y the username for the user (recommended max. 30 characters length)
password string Y The password for the user. It must be at least eight characters and must include a combination of three of the following character sets: 1. Upper case alphabet (A, B,...Z) 2. Lower case alphabet (a, b,...z) 3. Numeric (0, 1,...9) 4. Special characters, such as !#$%^&*()_+<,>.?/.
email string Y The email for the user
firstname string N The first name of the user
lastname string N The last name of the user
displayname string N The display name of the user
aboutme string N The profile for the user
title string N The title of the user
organization string N The organization or company for the user
address string N The address of the user
city string N The city of the user
region string N The region of the user
country string N The country of the user
website string N The website for the user
askDirectlyAllowed bool N Whether the user can be asked questions directly (true/false)
profileemail string N The profile email for the user
homenumber string N The home telephone number for the user
officenumber string N The office telephone number for the user
mobilenumber string N The mobile telephone number for the user
faxnumber string N The fax number for the user
facebookurl string N The Twitter URL for the user
twitterurl string N The Twitter URL for the user
linkedinurl string N The LinkedIn URL for the user
googleUrl string N The Google URL for the user
sso_userId string N The client SSO unique user id
externalprofileimageurl string N A url linking to the users profile image (if not managed on Answerbase)
customField[FIELD-ID] string N The value for the custom profile field whose ID is [FIELD-ID] (parameter name example: "customField54"). You can find the appropriate Field ID in the General Settings of your admin site, by hovering over the custom field name.
roles string N A comma separated list of roles that the user has. The values can be: "member", "moderator", "administrator" and "developer"

Sample request


    POST /api/v2/users
    {
    "username": "testuser",
    "password": "passw0rd",
    "email": "testuser@domain.com",
    }

Response

JSON
{
    "id": 100,
    "newuser", true
}

Update user

Allows a user’s data to be updated.

PUT /api/v2/users/update

Input

Name Data Type Mandatory Description
username
sso_userid
userid
useremail
string
string
string
string
N
(Provide one of the four parameters to identify the user)
Username, userid and useremail are the Answerbase values, sso_userid is the clients own userid
password string N The password for the user
email string N The email for the user
firstname string N The first name of the user
lastname string N The last name of the user
displayname string N The display name of the user
aboutme string N The profile for the user
title string N The title of the user
organization string N The organization or company for the user
address string N The address of the user
city string N The city of the user
region string N The region of the user
country string N The country of the user
website string N The website for the user
askDirectlyAllowed bool N Whether the user can be asked questions directly (true/false)
profileemail string N The profile email for the user
homenumber string N The home telephone number for the user
officenumber string N The office telephone number for the user
mobilenumber string N The mobile telephone number for the user
faxnumber string N The fax number for the user
facebookurl string N The Twitter URL for the user
twitterurl string N The Twitter URL for the user
linkedinurl string N The LinkedIn URL for the user
googleUrl string N The Google URL for the user
externalprofileimageurl string N A url linking to the users profile image (if not managed on Answerbase)
customField[FIELD-ID] string N The value for the custom profile field whose ID is [FIELD-ID] (parameter name example: "customField54"). You can find the appropriate Field ID in the General Settings of your admin site, by hovering over the custom field name.
roles string N A comma separated list of roles to add to the user. The values can be: "member", "moderator", "administrator" and "developer"

Sample request

PUT /api/v2/users/100
{
    "userid": 202,
    "displayname": "testuser",
    "firstname": "John"
}

Response

Empty (Check HTTP code for status).

Get user permissions

Retrieves a user’s permissions

GET /api/v2/users/get/permissions

Input

Name Data Type Mandatory Description
username
sso_userid
userid
useremail
string
string
string
string
N
(Provide one of the four parameters to identify the user)
Username, userid and useremail are the Answerbase values, sso_userid is the clients own userid

Sample request

GET /api/v2/users/get/permissions?userid=202

Response

JSON
{
    "canpostquestions": true,
    "canpostanswers": true,
    "allowlinks": true,
    "linksfollow": false,
    "featured": false,
    "visibleonlists": true,
    "haspublicprofile": true,
    "istrusted": true,
    "allowdirectquestions": true,
    "username": "dave"
}

Update user permissions

Allows a user’s permissions to be updated.

PUT /api/v2/users/permissions

Input

Name Data Type Mandatory Description
username
sso_userid
userid
useremail
string
string
string
string
N
(Provide one of the four parameters to identify the user)
Username, userid and useremail are the Answerbase values, sso_userid is the clients own userid
canpostquestions bool N Allows the user to post questions
canpostanswers bool N Allows the user to post answers
allowlinks bool N Allows the user to submit content with external links
linksfollow bool N Allow the links that the user submits within content to be followed by search engines
featured bool N Features the user
visibleonlists bool N Allows the user to be shown on the leaderboards and lists
haspublicprofile bool N Allows the user to have a public profile page
istrusted bool N Identify this user as a trusted member for anti-spam purposes
allowdirectquestions bool N Allows the user to receive direct questions by other users on the system

Sample request

PUT /api/v2/users/permissions
{
    "userid": 202
    "canpostquestions": false,
    "canpostanswers": false
}

Response

Empty (Check HTTP code for status).

Get user email settings

Retrieves the users email notification settings.

GET /api/v2/users/get/emailsettings

Input

Name Data Type Mandatory Description
username
sso_userid
userid
useremail
string
string
string
string
N
(Provide one of the four parameters to identify the user)
Username, userid and useremail are the Answerbase values, sso_userid is the clients own userid

Sample request

GET /api/v2/users/emailsettings?userid=202

Response

JSON
{
    "questionNewAnswersNotification": true,
    "answerNewAnswersNotification": false,
    "answerAcceptedNotification": false,
    "questionCommentsAfterNotification": false,
    "questionNewCommentsNotification": false,
    "answerCommentsAfterNotification": false,
    "answerNewCommentsNotification": false,
    "watchedQuestionsNotification": false,
    "watchedQuestionsNewCommentsNotification": false,
    "questionNewAnswerCommentsNotification": false,
    "username": "dave"
}

Update user email settings

Allows you to update the email notification settings for each user.

PUT /api/v2/users/emailsettings

Input

Name Data Type Mandatory Description
username
sso_userid
userid
useremail
string
string
string
string
N
(Provide one of the four parameters to identify the user)
Username, userid and useremail are the Answerbase values, sso_userid is the clients own userid
questionnewanswersnotification bool N Indicates whether the user will receive an email notification if an new answer is submitted to a question that has been asked by the user
answernewanswersnotification bool N Indicates whether the user will receive an email notification if an new answer is submitted to a question which has been answered by the user
questioncommentsafternotification bool N Indicates whether the user will receive an email notification if a comment is submitted to a question the user has commented on
questionnewcommentsnotification bool N Indicates whether the user will receive an email notification if the users question receives a comment
answercommentsafternotification bool N Indicates whether the user will receive an email notification if a comment is submitted to an answer the user has commented on
answernewcommentsnotification bool N Indicates whether the user will receive an email notification if an answer by the user receives a new comment
watchedquestionsnotification bool N Indicates whether the user will receive an email notification if a question they are following receives a new answer
watchedquestionsnewcommentsnotification bool N Indicates whether the user will receive an email notification if a question they are following receives a new comment
questionnewanswercommentsnotification bool N Indicates whether the user will receive an email notification if a comment is submitted to an answer of a question the user has asked
answeracceptednotification bool N Indicates whether the user will receive an email notification if the users answer was accepted as the best answer by the asking user

Sample request

PUT /api/v2/users/emailsettings
{
    "userid": 202,
    "questionnewanswersnotification": true,
    "answernewanswersnotification": true
}

Response

Empty (Check HTTP code for status).

Get user activity notifications list

Gets a list of activity notifications for the user order by most recent first

GET /api/v2/account/activitynotifications/list

Parameters

Name Data Type Mandatory Description
username
sso_userid
userid
useremail
string
string
string
string
N
(Provide one of the four parameters to identify the user)
Username, userid and useremail are the Answerbase values, sso_userid is the clients own userid
maxresults string N The maximum amount of results returned. 0 = all results.

Sample request

GET /api/v2/account/activitynotifications/list?userid=2216272&maxresults=2

Response

JSON
{
    totalnotificationscount      :int
    unviewednotificationscount   :int
    notifications                [{
                                       "id"           :int,
                                       "text"         :string,
                                       "title"        :string,
                                       "createtime"   :datetime,
                                       "url"          :string,
                                       "viewed"       :bool
                                 }]
}

EXAMPLE:
{
    "totalnotificationscount": 9,
    "unviewednotificationscount": 0,
    "notifications": [
        {
            "id": 334203,
            "text": "Your answer was recognized as the best answer to",
            "title": "How much is it if I buy in bulk?",
            "createtime": "2019-01-22T10:09:51",
            "url": "https://abc.answerbase.com/2604600/How-much#answer2604629",
            "viewed": true
        },
        {
            "id": 97966,
            "text": "<a class=\"userpopuplink\" href=\"http://abc.answerbase.com/
                    Profile/david2/\">david2</a> answered a question you also 
                    answered",
            "title": "new question",
            "createtime": "2018-07-03T07:44:57",
            "url": "https://abc.answerbase.com/2466998/new-question#answer2467047",
            "viewed": true
        }
    ]
}
    

Update user activity notification

Updates a user activity notification to be viewed

PUT /api/v2/account/activitynotifications/:id/setview

Input

Name Data Type Mandatory Description
id int Y Notification ID (from URL)
viewTime datetime Y Sets the time that the notification was viewed by the user

Sample request


PUT api/v2/account/activitynotifications/688637/setview
{
    "viewtime": "2019-10-16",
}

Response

Empty (Check HTTP code for status).

Categories/Tags

Get category

Gets a category with the specified id

GET /api/v2/categories/get

Parameters

Name Data Type Mandatory Description
id
externalId
int
string
Y Category ID
client defined ID

Sample request

GET /api/v2/categories/get?id=8877

Response

A category object.

Get categories list

Gets a list of categories based on a range of parameters

GET /api/v2/categories/list

Parameters

Name Data Type Mandatory Description
startindex int N The starting element to be returned (useful for paging). 0 = the first element
maxresults string N The maximum amount of results returned. 0 = all results.
restrictToFirstLevel bool N "true"/"false" - Defines whether to return child categories as well (default: "true")
orderby string N Possible values:
"adminorder" - orders by the order set by the administrators.
"questionscount" - orders by the amount of questions associated to each category.

Sample request

GET /api/v2/categories/list?restrictToFirstLevel=true

Response

A list of category objects.

Add Category

Creates a new category

POST /api/v2/categories/add

Parameters

Name Data Type Mandatory Description
externalId string Y Client defined ID
name string Y
url string Y The URL linking to the category page on your site. Max. length: 500 characters.
categoryParentExternalId string Y The client defined id of the parent category that this new category is a subcategory of.

Sample request


    POST /api/v2/categories/add
    {
    "externalid": "SHOES123",
    "name": "Ordinary Shoes",
    "url": "https://yoursite.com/ordinaryshoes",
    "categoryparentexternalid": "FOOTWEAR123"
    }

Response

(empty)

Update Category

Updates a category with the specified id

PUT /api/v2/categories/update

Parameters

Name Data Type Mandatory Description
id
externalId
int
string
Y Category ID
Client defined ID
name string Y
url string Y The URL linking to the category page on your site. Max. length: 500 characters.
categoryParentExternalId string Y The client defined id of the parent category that this category is a subcategory of.

Sample request


    PUT /api/v2/categories/update
    {
    "externalid": "SHOES123",
    "name": "Ordinary Shoes",
    "url": "https://yoursite.com/ordinaryshoes",
    "categoryparentexternalid": "FOOTWEAR123"
    }

Response

(empty)

Get tag

Gets a tag with the specified id

GET /api/v2/tags/get

Parameters

Name Data Type Mandatory Description
id
externalId
int
string
Y Tag ID
Client defined ID

Sample request

GET /api/v2/tags/get?id=8377

Response

A tag object.

Get tags list

Gets a list of tags

GET /api/v2/tags/list

Parameters

Name Data Type Mandatory Description
startindex int N The starting element to be returned (useful for paging). 0 = the first element
maxresults string N The maximum amount of results returned. 0 = all results.
orderby string N Possible values:
"adminorder" - orders by the order set by the administrators.
"questionscount" - orders by the amount of questions associated to each tag.

Sample request

GET /api/v2/tags/list?maxresults=10

Response

A list of tag objects.

Tags autosuggest

Searches for tags by keywords

GET /api/v2/tags/autosuggest

Parameters

Name Data Type Mandatory Description
term string N The term(s) to search for

Sample request

GET /api/v2/tags/autosuggest?term=cooling

Response

JSON
{
"totalCount": 3,
"tags": [
    {
        "label": "cooling",
        "id": 4400,
        "value": "cooling"
    },
    {
        "label": "cooling2",
        "id": 18729,
        "value": "cooling2"
    },
    {
        "label": "coolingTest",
        "id": 24882,
        "value": "coolingTest"
    }
    ]
}
    

Products

Get products list

Gets a list of products based on a range of parameters

GET /api/v2/products/list

Parameters

Name Data Type Mandatory Description
startindex int N The starting element to be returned (useful for paging). 0 = the first element
maxresults string N The maximum amount of results returned. 0 = all results.
keywords string N Can be a single keyword or a group of keywords. The keywords will be searched for within the product title and SKU.
categoryIds
categoryExternalIds
string
string
N
(Provide one of the two parameters)
One or more category IDs, separated by commas.
One or more category external IDs, separated by commas.
orderby string N Possible values:
"adminorder" - orders by the order set by the administrators.
"questionscount" - orders by the amount of questions associated to each product.

Sample request

GET /api/v2/products/list?maxresults=10

Response

A list of product objects.

Get product categories

Gets a list of product categories based on a range of parameters

GET /api/v2/products/getcategories

Parameters

Name Data Type Mandatory Description
startindex int N The starting element to be returned (useful for paging). 0 = the first element
maxresults string N The maximum amount of results returned. 0 = all results.
restrictToFirstLevel bool N "true"/"false" - Defines whether to return child categories as well (default: "true")
orderby string N Possible values:
"adminorder" - orders by the order set by the administrators.
"questionscount" - orders by the amount of questions associated to each category.

Sample request

GET /api/v2/products/getcategories?maxresults=10

Response

A list of category objects.

Products autosuggest

Searches for products by keywords

GET /api/v2/products/autosuggest

Parameters

Name Data Type Mandatory Description
query string N The term(s) to search for

Sample request

GET /api/v2/products/autosuggest?query=answerbase

Response

JSON
{
  "query": "answerbase",
  "suggestions": [
    "Answerbase Blue",
    "Answerbase Red"
  ],
  "data": [
    "https://lumincreative.com/question_answer_system_ws.html",
    "http://121026224127.3dcart.net/Answerbase-Red_p_8.html"
  ]
}

Add Product

Creates a new product

POST /api/v2/products/add

Input

Name Data Type Mandatory Description
ExternalID string Y A unique ID to identify the product. Max. length: 50 characters
SKU string N Max. length: 100 characters
Name string Y The name of the product. Max. length: 255 characters.
Description string N The product details. Max. length: 1000 characters.
ProductPageURL string N The URL linking to the product page on your ecommerce store. Max. length: 500 characters.
ProductImageURL string N The URL to the product image. Max. length: 500 characters.
Price decimal N The product price.
categoryexternalids string N A comma separated list of the product category external ids that this product is associated with.

Sample request


POST /api/v2/products/add
{
    "externalid": "SHOES123",
    "SKU": "123",
    "name": "Luxury Shoes",
    "price": "999.99"
}

Response

JSON
{
    "id": 102
}

Update Product

Updates an existing product

PUT /api/v2/products/update

Input

Name Data Type Mandatory Description
ExternalID string Y* This is the unique ID that you have defined for the product.
*You do have the option to use the SKU instead, but one of the values must be identified.
SKU string Y* Max. length: 100 characters
* You do have the option to use the ExternalID instead, but one of the values must be identified. If both are provided, the External ID is used to identify the product and the SKU will be updated with the value provided.
Name string N The name of the product. Max. length: 255 characters.
Description string N The product details. Max. length: 1000 characters.
ProductPageURL string N The URL linking to the product page on your ecommerce store. Max. length: 500 characters.
ProductImageURL string N The URL to the product image. Max. length: 500 characters.
Price decimal N The product price.
categoryexternalids string N A comma separated list of the product category external ids that this product is associated with.

Sample request


PUT /api/v2/products/update
{
    "externalid": "SHOES456",
    "name": "Sandals",
    "price": "59.49"
}

Response

JSON
{
    "id": 105
}

Update Category

Updates a category with the specified id

PUT /api/v2/products/categoryupdate

Parameters

Name Data Type Mandatory Description
id
externalId
int
string
Y Category ID
Client defined ID
name string Y
url string Y The URL linking to the category page on your store. Max. length: 500 characters.

Sample request


    PUT /api/v2/products/categoryupdate
    {
    "externalid": "SHOES123",
    "name": "Ordinary Shoes",
    "url": "https://yoursite.com/ordinaryshoes"
    }

Response

(empty)

Other methods

Get comment

Gets a comment with the specified id

GET /api/v2/comments/:id

Parameters

Name Data Type Mandatory Description
id int Y Comment ID (from URL)

Sample request

GET /api/v2/comments/24402

Response

A comment object.

Add comment

Allows a comment to be submitted to the application.

POST /api/v2/comments/add

Input

Name Data Type Mandatory Description
(user identifier) user identifier Y The author of the comment. Use any of valid identifier parameters
postid int Y The ID of the question or answer that the comment is related to.
text string Y the comment text
published bool Y true/false
publishTime datetime Y The specific time the comment was posted

Sample request

POST /api/v2/comments/add
{
    "postid": 20010
    "text": "This is a new comment"
    "userid": 202
    "published": false
}

Response

{
    "id": 2752219
}

Update comment

Allows a comment to be updated.

PUT /api/v2/comments/:id

Input

Name Data Type Mandatory Description
id int Y Comment ID (from URL)
text string N the comment text
published bool Y true/false
publishTime datetime Y The specific time the comment was posted

Sample request


PUT /api/v2/comments/24402
{
    "published": false
}

Response

Empty (Check HTTP code for status).

Report comment

Flags a comment for review

PUT /api/v2/comments/:id/report

Input

Name Data Type Mandatory Description
id int Y Comment ID (from URL)
(user identifier) user identifier Y Any of valid identifier parameters

Sample request

PUT /api/v2/comments/100/report
{
    "username" : "testuser"
}

Response

Empty (check HTTP code for status).

Vote comment

Allows a user to vote for a comment. Only positive votes (likes) are allowed.

PUT /api/v2/comments/:id/vote

Input

Name Data Type Mandatory Description
id int Y Comment ID (from URL)
(user identifier) user identifier Y Any of valid identifier parameters

Sample request

PUT /api/v2/comments/100/vote/1
{
    "username" : "testuser"
}

Response

Empty (check HTTP code for status).

Post image

Allows you to post an image to be used in new questions or answers.

POST /api/v2/files/postimage

Input

Name Data Type Mandatory Description
image file N File related to the image (read from multipart/mime request)
imageWidth int N If specified, the image will be resized based on given width
imageHeight int N If specified, the image will be resized based on given height

Sample request


PUT /api/v2/files/postimage
{
    "imageWidth": 50,
    "imageHeight": 50
}

Response

JSON
{
    "url"    :"",
}

Add Related Content

Allows you to associate “related content” to specific questions.

POST /api/v2/content/addrelatedcontent

Input

Name Data Type Mandatory Description
contentId int Y the Id of the content it is related to
title string Y The title to be used for the “related content” link
url string Y The destination URL to be used for the “related content” link

Sample request

POST /api/v2/content/addrelatedcontent
{
    "contentId": 520,
    "title": "A search engine"
    "url": "https://google.com"
}

Response

Empty (check HTTP code for status).

Log pageview

Registers a view of a particular page of content. This is used to determine popularity of for example questions.

POST /api/v2/content/:id/logview

Input

Name Data Type Mandatory Description
id int Y User ID (from URL)
username
sso_userid
userid
useremail
string
string
string
string
N
(Provide one of the four parameters)
Username, userid and useremail are the Answerbase values, sso_userid is the clients own userid
PageName string N The name of the page requested. I.e. "/2752038/What-is-the-best-saw"
QueryString string N
Referrer string N
IPAddress string N
UserAgent string N

Sample request

POST /api/v2/content/2752038/logview
{
    "userId": 202,
    "PageName": "/2752038/What-is-the-best-saw",
    "QueryString": "?uid=2216726&ac=5219312208",
    "Referrer": "https://google.com",
    "IPAddress": "127.0.0.1",
    "UserAgent": "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:47.0) Firefox/47.0"
}

Response

Empty (check HTTP code for status).

Add points

Add a custom points type to a user.

POST /api/v2/points/add

Input

Name Data Type Mandatory Description
(user identifier) user identifier Y The user to give the points to. Use any of valid identifier parameters
externalid string Y The external ID (defined by the customer) of the points to add.

Sample request

POST /api/v2/points/add
{
    "externalid": "ex1992",
    "userid": 202
}

Response

{
    "id": 2752219
}

Get email notifications list

Gets a list of emails sent out by the system within a timeperiod

GET /api/v2/email/notificationslist

Parameters

Name Data Type Mandatory Description
fromDateTime datetime Y The start of the time period the emails have been sent within. Format: YYYY-MM-DD HH:MM
toDateTime datetime N The end of the time period the emails have been sent within. Format: YYYY-MM-DD HH:MM

Sample request

GET /api/v2/email/notificationslist?fromDateTime=2024-01-30 14:00

Response

JSON
{
    "totalCount": int,
    "emails": [
        {
        "id": int,
        "sso_userid": string,
        "createtime": datetime,
        "subject": string,
        "body": string,
        "type": string,
        "questionid": int,
        "product_ids": [],
        "productcategory_ids": [],
        "category_ids": [],
        "external_product_ids": [],
        "external_productcategory_ids": [],
        "external_category_ids": []
        }]
}

EXAMPLE:
{
    "totalCount": 19,
    "emails": [
    {
        "id": 15853073,
        "sso_userid": 9989,
        "createtime": "2024-02-25T16:00:50",
        "subject": "New Answer to Your Question: I need replacement Axles",
        "body": "Dear Guest, We're notifying you about a new answer",
        "type": "4",
        "questionid": 4843101,
        "product_ids": [123],
        "productcategory_ids": [],
        "category_ids": [],
        "external_product_ids": ["x56556"],
        "external_productcategory_ids": [],
        "external_category_ids": []
    },
    ...
    ]
}

Tokens

Get a token

Retrieving a 24-hour valid token for user's credentials:

POST /api/v2/token

Input

Name Data Type Mandatory Description
grant_type string Y Currently supported value: "password"
username string Y Client's website URL at Answerbase (without protocole/www prefixes)
password string Y Client's API key

Sample request

POST /api/v2/token
{
"grant_type": "password",
"username": "abc.answerbase.com",
"password": "2kefHUowd3tdm2Opwdkhasd"
}

Response

A token object.

Change Log

Version 2.1, Last Revised: May. 24th, 2021

Version 2.1

- Updated methods Get Questions List, Search Questions and Get Featured Questions adding "productexternalid" as optional parameter to filter the questions by.

- Added Add Product and Update Product methods

Version 2.0

New API published