Survey Response Reporting
Locating your report_id: This method can only be run on saved reports. Once you save your report you can visit the View Survey Visits page, on which you'll see at the top a section labeled “Reporting API URL.” This will be the full URL you will use for survey response reporting via the API.
Survey Response Reporting
GET
https://insight.plumvoice.com/api/report/{report_id}
This method allows you to fetch CSV exports of your saved survey reports programmatically (or through your browser, authenticating via http basic). There are a number of optional parameters supplied which will allow for you to paginate responses when working with very large data sets.
Path Parameters
Name | Type | Description |
---|---|---|
report_id | integer | The |
Headers
Name | Type | Description |
---|---|---|
content-type | string | application/x-www-form-urlencoded |
Request Body
Name | Type | Description |
---|---|---|
start_timestamp | integer | Unix timestamp to filter your survey responses to a specific date range. |
end_timestamp | integer | Unix timestamp to filter your survey responses to a specific date range. |
offset | integer | Offset when querying for a row range. The offset will indicate at which row in the result set to begin including rows in the response csv. If you set an offset of 25, the first 25 rows will be ignored and row 26 will be the first row included in the response. |
limit | integer | Limit the number of rows returned. The limit must be between 1 and 10,000. If no limit is supplied, the limit will be 500. |
NOTE: Results will be ordered in descending order by start time, so the most recent response will always be first. The start_timestamp
and end_timestamp
parameters are dependent on one another; if you supply one, you must supply the other. By default, if no parameters are supplied, the response will contain the full date range of survey responses with an offset of 0 and limit of 500, returning up to 500 of the most recent survey visits.
Possible Response Codes
200: success
400: parameters supplied were not valid
401: authentication headers invalid or the account is inactive
403: you do not own the report
404: the saved report was not found or no rows were matched for the report
405: invalid HTTP method supplied (only GET allowed)
500: server error
Response Notes
Headers
Since the payload of a successful request will be the csv data for the report, we've included a number of headers that will act as metadata related to the returned data and the overall data for the report. The following headers will be included:
Header Name | Type | Description |
X-Plum-Total-Rows | int | This value indicates the total number of rows that matched the query. |
X-Plum-Returned-Rows | int | This value indicates the total number of rows returned in the response. |
X-Plum-Row-Offset | int | This value indicates the offset applied to the current response. |
X-Plum-Row-Limit | int | This value indicates the limit applied to the current response. |
These headers should allow you to paginate your requests, if you're working with a very large data set.
Structure
The return structure differs based on whether rows were matched or not.
A successful response, one in which rows were matched, will always return an http code of 200 and the body of the response will be in text/CSV format, which will be the raw output of your CSV report. A sample of a successful response would be the following:
NOTE: A successful response will always contain the header fields of the CSV. If you are paginating, be sure to trim this off before appending the rows to an existing CSV.
An unsuccessful request, one in which no csv rows were returned and the http code was not 200, contains the following item(s):
Name | Data Type | Always Present | Description |
error | string | yes | Descriptive message indicating what error(s) occurred |
Sample Code
This sample PHP code makes a request to fetch the first 10 items of a saved report:
Last updated