Retrieve Space List

You can use this API request to retrieve a paged list of the spaces that have been created on your AnswerHub site.

/services/v2/space.json

You can use the following parameters in your retrieve a space list request:

Projection: include, exclude, includeOnly
Other options: wrap, v1

🚧

Permissions & Notes:

  • You must have the Use site permission under Anonymous Roles under the Advanced Editor.

  • You must have the View the questions list permission under the Anonymous Roles under the Advanced Editor for each space. If you don't have this permission for the space, that space will not show up in the list.

  • You can use the sort request parameter to specify which of the sorting and ordering criteria you want used.

    • An invalid sorting name will cause the request to reset to the default criteria.
  • The ?includeOnly= request parameter will return the list including only the fields specified.

    • This will only return items the authenticated user has the ability to see.
  • With the includeOnly parameter set to id and name (/services/v2/space.json?includeOnly=id,name) to the AnswerHub REST API.

  • We added this request in version 1.6.3.

Sample Request

A GET retrieve a space list request sent to https://apidocs.cloud.answerhub.com using a human-readable Username/Password (answerhub/test123) would look like this:

curl 
-u answerhub:test123 
-H "Accept: application/json" 
-H "Content-type: application/json" 
-X GET "https://apidocs.cloud.answerhub.com/services/v2/space.json"

👍

Use of pageSize:

Note, we use the parameter pageSize = 1 to decrease the length of the JSON Response shown below. Without this parameter, the response will display a full page worth of response. To change pages, simply add the page=[pageNumber] parameter in your query.

Sample Response

Successful Response:

  • HTTP Status 200 - OK
{
    "name": "",
    "sort": "",
    "page": 1,
    "pageSize": 4,
    "pageCount": 1,
    "listCount": 4,
    "totalCount": 4,
    "list": [
        {
            "id": 8,
            "type": "space",
            "name": "Default",
            "prefix": "space8",
            "creationDate": 1542778947000,
            "active": true,
            "parentId": 7
        },
        {
            "id": 9,
            "type": "space",
            "name": "Help",
            "prefix": "space9",
            "creationDate": 1542778947000,
            "active": true,
            "parentId": 7
        },
        {
            "id": 11,
            "type": "space",
            "name": "Test Space",
            "prefix": "space11",
            "locale": "en",
            "creationDate": 1548189175000,
            "active": true,
            "parentId": 7
        },
        {
            "id": 21,
            "type": "space",
            "name": "Analytics Test Space",
            "prefix": "space21",
            "locale": "en",
            "creationDate": 1548958269000,
            "active": true,
            "parentId": 7
        }
    ]
}
Language
Authorization
Basic
base64
:
Click Try It! to start a request and see the response here!