Poll

With polls you can ask for your users for their opinion. In any given moment, you can have only one active poll.

Method: list

Authorization is required.

Request

HTTP request

GET https://<YOUR_DOMAIN>/api/v1/en_US/poll/list/{groupId}?offset={offset}&pageSize={pageSize}&filter={filter}

Parameters

property value description
groupId guid The polls group's ID
offset integer Needed for the infinite scroll functionality. It is the ID of the last presented item to the user. After the request list is generated the system will skip all records from the beginning up to the record with the provided ID (including it). The next batch of records will be returned in the response.
pageSize integer How many records to be returned by the system. Usually 15
filter string Query string to be looked for when filtering the records

Request body

Do not supply a request body with this method.

Response

If successful, this method returns a response JSON with the following structure:

{
  "success": true,
  "message": "Laborum sunt esse voluptate excepteur tempor id sint.",
  "timestamp": "2014-03-03T23:20:23Z",
  "errors": [],
  "object": {
    "offset": 767,
    "polls": [
      {
        "id": 1,
        "type": "poll",
        "group": {
          "id": "bc82ea97-c9fd-408b-8830-63e8d44d0542",
          "name": "eiusmod",
          "slug": "Home",
          "thumbUrl": "http://demo.hivesocialnow.com/logo/72_635267855582630000.png",
          "url": "http://demo.hivesocialnow.com/Home/"
        },
        "active": false,
        "question": "Reprehenderit exercitation veniam nostrud dolor consequat tempor quis cupidatat culpa deserunt labore.",
        "totalVotes": 71,
        "answers": [
          {
            "id": 1,
            "position": 1,
            "text": "eiusmod exercitation",
            "votes": 49
          },
          {
            "id": 2,
            "position": 2,
            "text": "minim quis",
            "votes": 61
          },
          {
            "id": 3,
            "position": 3,
            "text": "adipisicing occaecat",
            "votes": 17
          }
        ],
        "accessWarnings": []
      }
    ]
  }
}

The general response properties are described on the Response format page. Here are the list of the specific properties for this method.

Method: get

Authorization is required.

Request

HTTP request

GET https://<YOUR_DOMAIN>/api/v1/en_US/poll/{pollId}

Parameters

property value description
pollId integer The poll's ID

Request body

Do not supply a request body with this method.

Response

If successful, this method returns a response JSON with the following structure:

{
  "success": true,
  "message": "Est laboris non cillum culpa aliquip fugiat proident dolore eu occaecat.",
  "timestamp": "2014-03-03T23:20:23Z",
  "errors": [],
  "object": {
    "id": 1,
    "type": "poll",
    "group": {
      "id": "2fa4f9d9-d4c7-4b79-9cde-6f3a73a6f6fb",
      "name": "exercitation",
      "slug": "Home",
      "thumbUrl": "http://demo.hivesocialnow.com/logo/72_635267855582630000.png",
      "url": "http://demo.hivesocialnow.com/Home/"
    },
    "active": false,
    "question": "Cillum qui nostrud consequat non magna amet pariatur irure in ullamco et est proident.",
    "totalVotes": 40,
    "answers": [
      {
        "id": 1,
        "position": 1,
        "text": "labore aliqua",
        "votes": 56
      },
      {
        "id": 2,
        "position": 2,
        "text": "consectetur cillum",
        "votes": 84
      },
      {
        "id": 3,
        "position": 3,
        "text": "velit anim",
        "votes": 100
      }
    ],
    "accessWarnings": []
  }
}

The general response properties are described on the Response format page. Here are the list of the specific properties for this method.

Method: create

Authorization is required.

Request

HTTP request

POST https://<YOUR_DOMAIN>/api/v1/en_US/poll

Parameters

Do not supply a request parameters with this method.

Request body

property value description
groupId guid In which group to create the record
active boolean Activate (true) or not the newly created poll. If true any other active poll will be deactivated.
question string The question text
answers list (object) What are the poll answers. The answer object has the following properties:
  • id - the answer id. If null the system will assume that this is a newly added answer, that needs to be created.
  • position - the position of the answer within the list
  • text - the answer text

Response

If successful, this method returns a response JSON with the following structure:

{
  "timestamp": "2014-03-03T23:20:23Z",
  "success": true,
  "message": "Poll was updated",
  "errors": [
    {
      "key": "question",
      "value": "",
      "message": "Question cannot be blank"
    },
    {
      "key": "answers",
      "value": "",
      "message": "One or more answers are blank"
    }
  ],
  "object": {
    "id": 1,
    "type": "poll",
    "group": {
      "id": "2fa4f9d9-d4c7-4b79-9cde-6f3a73a6f6fb",
      "name": "exercitation",
      "slug": "Home",
      "thumbUrl": "http://demo.hivesocialnow.com/logo/72_635267855582630000.png",
      "url": "http://demo.hivesocialnow.com/Home/"
    },
    "active": false,
    "question": "Cillum qui nostrud consequat non magna amet pariatur irure in ullamco et est proident.",
    "totalVotes": 40,
    "answers": [
      {
        "id": 1,
        "position": 1,
        "text": "labore aliqua",
        "votes": 56
      },
      {
        "id": 2,
        "position": 2,
        "text": "consectetur cillum",
        "votes": 84
      },
      {
        "id": 3,
        "position": 3,
        "text": "velit anim",
        "votes": 100
      }
    ],
    "accessWarnings": []
  }
}

The general response properties are described on the Response format page. Here are the list of the specific properties for this method.

property value description
success Boolean Whether the requested operation is successful or not
message String Human readable error information
errors List (object) List of validation errors, if any. The "key" property value is matched to one of the record's fields
object object The object that caused the validation errors or that was created. Have in mind that, if the server requires string trimming or data manipulation after the user submission, it is applied in this object. In this way the returned object can differe from the posted one.

Method: update

Authorization is required.

Request

HTTP request

PUT https://<YOUR_DOMAIN>/api/v1/en_US/poll/{pollId}

Parameters

property value description
pollId integer In id of the updated record

Request body

property value description
groupId guid In which group to create the record
active boolean Activate (true) or not the newly created poll. If true any other active poll will be deactivated.
question string The question text
answers list (object) What are the poll answers. The answer object has the following properties:
  • id - the answer id. If null the system will assume that this is a newly added answer, that needs to be created.
  • position - the position of the answer within the list
  • text - the answer text

Response

If successful, this method returns a response JSON with the following structure:

{
  "timestamp": "2014-03-03T23:20:23Z",
  "success": true,
  "message": "Poll was updated",
  "errors": [
    {
      "key": "question",
      "value": "",
      "message": "Question cannot be blank"
    },
    {
      "key": "answers",
      "value": "",
      "message": "One or more answers are blank"
    }
  ],
  "object": {
    "id": 1,
    "type": "poll",
    "group": {
      "id": "2fa4f9d9-d4c7-4b79-9cde-6f3a73a6f6fb",
      "name": "exercitation",
      "slug": "Home",
      "thumbUrl": "http://demo.hivesocialnow.com/logo/72_635267855582630000.png",
      "url": "http://demo.hivesocialnow.com/Home/"
    },
    "active": false,
    "question": "Cillum qui nostrud consequat non magna amet pariatur irure in ullamco et est proident.",
    "totalVotes": 40,
    "answers": [
      {
        "id": 1,
        "position": 1,
        "text": "labore aliqua",
        "votes": 56
      },
      {
        "id": 2,
        "position": 2,
        "text": "consectetur cillum",
        "votes": 84
      },
      {
        "id": 3,
        "position": 3,
        "text": "velit anim",
        "votes": 100
      }
    ],
    "accessWarnings": []
  }
}

The general response properties are described on the Response format page. Here are the list of the specific properties for this method.

property value description
success Boolean Whether the requested operation is successful or not
message String Human readable error information
errors List (object) List of validation errors, if any. The "key" property value is matched to one of the record's fields
object object The object that caused the validation errors or that was updated. Have in mind that, if the server requires string trimming or data manipulation after the user submission, it is applied in this object. In this way the returned object can differe from the posted one.

Method: delete

Authorization is required.

Request

HTTP request

DELETE https://<YOUR_DOMAIN>/api/v1/en_US/poll/{pollId}

Parameters

property value description
pollId integer In id of the deleted record

Request body

Do not supply a request body with this method.

Response

If successful, this method returns a response JSON with the following structure:

{
  "timestamp": "2014-03-03T23:20:23Z",
  "success": true,
  "message": "Poll was updated",
  "errors": [
    {
      "key": "question",
      "value": "",
      "message": "Question cannot be blank"
    },
    {
      "key": "answers",
      "value": "",
      "message": "One or more answers are blank"
    }
  ],
  "object": {
    "id": 1,
    "type": "poll",
    "group": {
      "id": "2fa4f9d9-d4c7-4b79-9cde-6f3a73a6f6fb",
      "name": "exercitation",
      "slug": "Home",
      "thumbUrl": "http://demo.hivesocialnow.com/logo/72_635267855582630000.png",
      "url": "http://demo.hivesocialnow.com/Home/"
    },
    "active": false,
    "question": "Cillum qui nostrud consequat non magna amet pariatur irure in ullamco et est proident.",
    "totalVotes": 40,
    "answers": [
      {
        "id": 1,
        "position": 1,
        "text": "labore aliqua",
        "votes": 56
      },
      {
        "id": 2,
        "position": 2,
        "text": "consectetur cillum",
        "votes": 84
      },
      {
        "id": 3,
        "position": 3,
        "text": "velit anim",
        "votes": 100
      }
    ],
    "accessWarnings": []
  }
}

The general response properties are described on the Response format page. Here are the list of the specific properties for this method.

property value description
success Boolean Whether the requested operation is successful or not
message String Human readable error information
errors List (object) This list very rarely contains records during delete method processing
object object The object that was deleted