SurveyMonkey: Where is the text of my respondent's response? - surveymonkey

I'm new to the SurveyMonkey API and it hasn't been too difficult to get payloads back from API calls, but right now I'm trying to get back what responses a specific respondent gave.
I have a survey which has two respondents, the first question on the survey asks the user to enter three pieces of information: Their Name, an ID and today's date.
So, if I do a call to get_survey_details, I can see the questions just fine. For example
obj.pages[0].questions[0].answers[0].answerid: "xxxxxxxx" //some long ID
obj.pages[0].questions[0].answers[0].text: "Enter Your Name"
obj.pages[0].questions[0].answers[0].type: "row"
There's a couple more pieces of information in that object, like whether the question is visible, etc., but these seem to be the pertinent pieces to the question I have.
So! I make another call to get_responses using the same survey_id and respondent_id (there's only two so actually I get them both).
In the resulting payload I get an array of 2 objects (one to hold each respondents responses). So I look in the first (obj[0]) and I see an array of questions and the respondent id. Fine. I look in the questions array and I see one object for each question and in each of those an answers object.
so that's:
obj[0].questions[0].answers[0].col: "yyyyyy" //some long ID
obj[0].questions[0].answers[0].row: "nnnnnn" //some other long ID
No response text. just this row/col business.
At this point, I'm super-confused (which is like regular confused, but with a cape). Where the heck are the respondents actual responses?
What the heck does "row" and "column" reference? Do I have to do some other API call with the row and/or column in order to get the text of the respondent's response?
I've looked through the documentation (and will continue to do so after posting this) and through stackoverflow to see if anyone else has asked this before. There was one question that came close, but really they were just forgetting to pair 'get_responses' with 'get_survey_details'. I'm doing that, but am still lost as ever. And I don't see any documentation really explaining in detail how this row/column concept works for mapping responses to the text of the response. :/
I know this is a really long-winded question, but I'm just so confused as to how to actually get responses out of this API. :(
Thanks for reading.

The text for a given response should come through under the "text" key. e.g. for a survey that only consists of an essay style question:
{
"status": 0,
"data": [
{
"respondent_id": "123456",
"questions": [
{
"answers": [
{
"text": "This is an essay style answer.",
"row": "0"
}
],
"question_id": "78910"
}
]
}
]
}
"row" and "col" literally reference the row and column of an answer - e.g. in a matrix question, there will be a list of rows for different questions ("what did you think of the hotel?") and ratings ("bad, okay, great") - and each answer is a combination of these. For a regular multiple choice question there will be multiple rows and only one column.
Calling "get_responses" with the correct respondent_id should provide you with the text response that you want. It's only the fixed details of the answer stored in the survey itself you should have to look up (provided in get_survey_details).

Using GET : /surveys/{survey_id}/details, we can get the corresponding question Ids along with the answer Ids.
{
"pages": [
{
"href": "https://api.surveymonkey.net/v3/surveys/87263608/pages/260492760",
"description": "",
"questions": [
{
"sorting": null,
"family": "matrix",
"subtype": "rating",
"required": {
"text": "This question requires an answer.",
"amount": "0",
"type": "all"
},
"answers": {
"rows": [
{
"visible": true,
"text": "",
"position": 1,
"id": "10788526669"
}
],
"choices": [
{
"description": "Not at all likely",
"weight": -100,
"id": "10788526670",
"visible": true,
"is_na": false,
"text": "Not at all likely - 0",
"position": 1
},
{
"description": "",
"weight": -100,
"id": "10788526671",
"visible": true,
"is_na": false,
"text": "1",
"position": 2
},
{
"description": "",
"weight": -100,
"id": "10788526672",
"visible": true,
"is_na": false,
"text": "2",
"position": 3
},
{
"description": "",
"weight": -100,
"id": "10788526673",
"visible": true,
"is_na": false,
"text": "3",
"position": 4
},
{
"description": "",
"weight": -100,
"id": "10788526674",
"visible": true,
"is_na": false,
"text": "4",
"position": 5
},
{
"description": "",
"weight": -100,
"id": "10788526675",
"visible": true,
"is_na": false,
"text": "5",
"position": 6
},
{
"description": "",
"weight": -100,
"id": "10788526676",
"visible": true,
"is_na": false,
"text": "6",
"position": 7
},
{
"description": "",
"weight": 0,
"id": "10788526677",
"visible": true,
"is_na": false,
"text": "7",
"position": 8
},
{
"description": "",
"weight": 0,
"id": "10788526678",
"visible": true,
"is_na": false,
"text": "8",
"position": 9
},
{
"description": "",
"weight": 100,
"id": "10788526679",
"visible": true,
"is_na": false,
"text": "9",
"position": 10
},
{
"description": "Extremely likely",
"weight": 100,
"id": "10788526680",
"visible": true,
"is_na": false,
"text": "Extremely likely - 10",
"position": 11
}
]
},
"visible": true,
"href": "https://api.surveymonkey.net/v3/surveys/87263608/pages/260492760/questions/1044924866",
"headings": [
{
"heading": "How likely is it that you would recommend XYZ to a friend or colleague?"
}
],
"position": 1,
"validation": null,
"id": "1044924866",
"forced_ranking": false
},
{
"sorting": null,
"family": "single_choice",
"subtype": "vertical",
"required": null,
"answers": {
"choices": [
{
"visible": true,
"text": "High Interest",
"position": 1,
"id": "10788529403"
},
{
"visible": true,
"text": "Long process",
"position": 2,
"id": "10788529404"
},
{
"visible": true,
"text": "Low XYZ Amount",
"position": 3,
"id": "10788529405"
},
{
"visible": true,
"text": "Lot of Documents",
"position": 4,
"id": "10788529406"
},
{
"visible": true,
"text": "Bad customer service",
"position": 5,
"id": "10788529407"
}
]
},
"visible": true,
"href": "https://api.surveymonkey.net/v3/surveys/87263608/pages/260492760/questions/1044925207",
"headings": [
{
"heading": "What is the most important issue which we need to address for overall a better service?"
}
],
"position": 2,
"validation": null,
"id": "1044925207",
"forced_ranking": false
}
],
"title": "",
"position": 1,
"id": "260492760",
"question_count": 2
}
],
}
We can use these ids to decipher the answer we get after fetching responses using get response API(Bulk or each respondent).
For eg:,
If my survey has two questions, like
Then after fetching the responses we get a json like this:
{
"total_time": 34,
"href": "https://api.surveymonkey.net/v3/collectors/94630092/responses/5120000552",
"custom_variables": {},
"ip_address": "182.76.20.30",
"id": "5120000552",
"logic_path": {},
"date_modified": "2016-12-01T11:01:11+00:00",
"response_status": "completed",
"custom_value": "LAI100023",
"analyze_url": "http://www.surveymonkey.com/analyze/browse/EvaBWWcU9K1XTH_2FFFBTfFul4ge94MwVWvBk0eAFDJ3c_3D?respondent_id=5120000552",
"pages": [
{
"id": "260492760",
"questions": [
{
"id": "1044924866",
"answers": [
{
"choice_id": "10788526677",
"row_id": "10788526669"
}
]
},
{
"id": "1044925207",
"answers": [
{
"choice_id": "10788529404"
}
]
}
]
}
],
"page_path": [],
"recipient_id": "2743199128",
"collector_id": "94630092",
"date_created": "2016-12-01T11:00:37+00:00",
"survey_id": "87263608",
"collection_mode": "default",
"edit_url": "http://www.surveymonkey.com/r/?sm=SfTljxZSoBFvaRUeGSI6L813qctjfG_2FDCVcqCks7CDc4TcJC_2BNHqmPYD7NNTcvST",
"metadata": {
"contact": {
"first_name": {
"type": "string",
"value": "John"
},
"last_name": {
"type": "string",
"value": "Doe"
},
"email": {
"type": "string",
"value": "neeta#xyz.com"
}
}
}
}
We can map the questions and answers using their IDs in this response with the ids we got from survey details. For open ended text questions, we get direct typed responses.

Related

My EF Core 6 OData endpoint is returning whole infrastructure instead of model?

My EF Core application is returning what I imagine is context information in response instead of model. When calling the endpoint with expand option. This is the result returned:
{
"$id": "1",
"instance": null,
"container": {
"$id": "2",
"name": "SurveyQuestionValidations",
"value": null,
"next0": {
"$id": "3",
"name": "Id",
"value": 1,
"autoSelected": true
},
"autoSelected": false
},
"model": {
"$id": "4",
"schemaElements": [
{
"$id": "5",
"declaredKey": [
{
"$id": "6",
"defaultValueString": null,
"propertyKind": 1,
"type": {
"isNullable": false,
"definition": {
"$id": "7",
"name": "Int32",
"namespace": "Edm",
"typeKind": 1,
"primitiveKind": 9,
"schemaElementKind": 1,
"fullName": "Edm.Int32"
}
},
"declaringType": {
"$ref": "5"
},
"name": "Id"
}
],
"schemaElementKind": 1,
"namespace": "Data.Models",
"name": "SurveyQuestion",
"fullName": "Data.ModelsSurveyQuestion",
"typeKind": 2,
"hasStream": false,
"isAbstract": false,
"isOpen": false,
"declaredProperties": [ ...etc
This only happens when using expand. And the query is really slow but I believe it is related.

Recently Issue face in Input.date and Input.choice in AdaptiveCard While Integrating chatBot with Teams

While using input.choice with confirmation message in adaptive card rest at that time dropdown of choice list is not showing up, we started facing this problem recently before it was working properly.
This was the code we were using at first when it was having proper behaviour
TeamsAdaptiveCardRest adaptiveCardRest = new TeamsAdaptiveCardRest();
List<TeamsItemsChoiceRest> choiceList =
createTeamsItemChoiceRestList((MapUserMessageRest) chatUserResponse.getOptions());
TeamsTextBlockRest textBlock = new TeamsTextBlockRest();
textBlock.setText(chatUserResponse.getMessage());
TeamsStaticItemListRest staticItemListRest = new TeamsStaticItemListRest();
staticItemListRest.setChoices(choiceList);
staticItemListRest.setPlaceholder("select");
staticItemListRest.setId(String.valueOf(chatUserResponse.getChatBrainId()));
TeamsToggleElementsRest enableConfirmationMessage = createToggleElements("confirmationToggle", true);
TeamsToggleElementsRest enableActionButton = createToggleElements("actionButton", true);
TeamsToggleActionRest toggleSelectAction = new TeamsToggleActionRest();
toggleSelectAction
.setTargetElements(Lists.newArrayList(enableConfirmationMessage, enableActionButton));
TeamsContainerRest inputChoiceContainer = new TeamsContainerRest();
inputChoiceContainer.setVisible(true);
inputChoiceContainer.setItems(Lists.newArrayList(textBlock, staticItemListRest));
inputChoiceContainer.setSelectAction(toggleSelectAction);
adaptiveCardRest.addInBody(inputChoiceContainer);
TeamsContainerRest confirmationMessageContainer = new TeamsContainerRest();
confirmationMessageContainer.setItems(
Lists.newArrayList(new TeamsTextBlockRest(chatUserResponse.getConfirmationMessage())));
confirmationMessageContainer.setId("confirmationToggle");
confirmationMessageContainer.setVisible(false);
adaptiveCardRest.addInBody(confirmationMessageContainer);
TeamsActionSubmitRest submitAction = new TeamsActionSubmitRest("Yes");
TeamsToggleElementsRest disableConfirmationMessage =
createToggleElements("confirmationToggle", false);
TeamsToggleElementsRest disableActionButton = createToggleElements("actionButton", false);
TeamsToggleActionRest toggleDisabledAction = new TeamsToggleActionRest();
toggleDisabledAction
.setTargetElements(Lists.newArrayList(disableConfirmationMessage, disableActionButton));
toggleDisabledAction.setTitle("Cancel");
TeamsActionSetRest actionButtionSetRest = new TeamsActionSetRest();
actionButtionSetRest.setVisible(false);
actionButtionSetRest.setId("actionButton");
actionButtionSetRest.setActions(Lists.newArrayList(submitAction, toggleDisabledAction));
adaptiveCardRest.addInBody(actionButtionSetRest);
return adaptiveCardRest;
Json for the above code:
{
"type": "AdaptiveCard",
"version": "1.5",
"body": [
{
"type": "Container",
"id": null,
"items": [
{
"type": "TextBlock",
"text": "Input.choice",
"wrap": true
},
{
"type": "Input.ChoiceSet",
"choices": [
{
"title": "a",
"value": "aa",
"id": "aa"
}
],
"id": "39",
"value": null,
"placeholder": "select"
}
],
"selectAction": {
"type": "Action.ToggleVisibility",
"title": null,
"id": null,
"targetElements": [
{
"elementId": "confirmationToggle",
"visible": true,
"isVisible": true
},
{
"elementId": "actionButton",
"visible": true,
"isVisible": true
}
]
},
"visible": true,
"isVisible": true
},
{
"type": "Container",
"id": "confirmationToggle",
"items": [
{
"type": "TextBlock",
"text": "Are you sure?",
"wrap": true
}
],
"selectAction": null,
"visible": false,
"isVisible": false
},
{
"type": "ActionSet",
"actions": [
{
"type": "Action.Submit",
"title": "Yes",
"associatedInputs": "auto",
"data": null
},
{
"type": "Action.ToggleVisibility",
"title": "Cancel",
"id": null,
"targetElements": [
{
"elementId": "confirmationToggle",
"visible": false,
"isVisible": false
},
{
"elementId": "actionButton",
"visible": false,
"isVisible": false
}
]
}
],
"id": "actionButton",
"visible": false,
"isVisible": false
}
],
"selectAction": null,
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json"
}
We are facing same issue in input.date with confirmation message in that dropdown of datepicker doesn't show up
Due to the change in behaviour the dropdown of input.choice and input.date Doesn't show with confirmation message so It was working properly before but recently behaviour changed, So want to know the reason behind the change in behaviour.
enter image description here

Pull Request Lists and the set of approvers from BITBUCKET SERVER API

Is it possible to get the List of all pull request with the details like the date when it was raised, the Person who raised it and the list of all the approvers from the BITBUCKET SERVER using the REST APIs
Absolutely, You can fetch the list of Pull requests along with all the other details like who raised it, when it was raised and who are the reviewers using the following API,
https://docs.atlassian.com/bitbucket-server/rest/7.4.0/bitbucket-rest.html#idp285
You will have the following as response,
{
"size": 1,
"limit": 25,
"isLastPage": true,
"values": [
{
"id": 101,
"version": 1,
"title": "Talking Nerdy",
"description": "It’s a kludge, but put the tuple from the database in the cache.",
"state": "OPEN",
"open": true,
"closed": false,
"createdDate": 1359075920,
"updatedDate": 1359085920,
"fromRef": {
"id": "refs/heads/feature-ABC-123",
"repository": {
"slug": "my-repo",
"name": null,
"project": {
"key": "PRJ"
}
}
},
"toRef": {
"id": "refs/heads/master",
"repository": {
"slug": "my-repo",
"name": null,
"project": {
"key": "PRJ"
}
}
},
"locked": false,
"author": {
"user": {
"name": "tom",
"emailAddress": "tom#example.com",
"id": 115026,
"displayName": "Tom",
"active": true,
"slug": "tom",
"type": "NORMAL"
},
"role": "AUTHOR",
"approved": true,
"status": "APPROVED"
},
"reviewers": [
{
"user": {
"name": "jcitizen",
"emailAddress": "jane#example.com",
"id": 101,
"displayName": "Jane Citizen",
"active": true,
"slug": "jcitizen",
"type": "NORMAL"
},
"lastReviewedCommit": "7549846524f8aed2bd1c0249993ae1bf9d3c9998",
"role": "REVIEWER",
"approved": true,
"status": "APPROVED"
}
],
"participants": [
{
"user": {
"name": "dick",
"emailAddress": "dick#example.com",
"id": 3083181,
"displayName": "Dick",
"active": true,
"slug": "dick",
"type": "NORMAL"
},
"role": "PARTICIPANT",
"approved": false,
"status": "UNAPPROVED"
},
{
"user": {
"name": "harry",
"emailAddress": "harry#example.com",
"id": 99049120,
"displayName": "Harry",
"active": true,
"slug": "harry",
"type": "NORMAL"
},
"role": "PARTICIPANT",
"approved": true,
"status": "APPROVED"
}
],
"links": {
"self": [
{
"href": "http://link/to/pullrequest"
}
]
}
}
],
"start": 0 }

Adaptive Cards iOS - How do I add padding around the card edge?

I'm trying to add padding to my adaptive card view so that it's contents are inset from the edge of the card. I'd like to not adjust the padding of any of the internal card elements. I'm trying to use the following host config, which parses without error but seems to have no effect on the card.
Host config JSON:
{
"spacing": {
"small": 3,
"default": 8,
"medium": 20,
"large": 30,
"extraLarge": 40,
"padding": 100
},
"adaptiveCard": {
"allowCustomStyle": true,
"spacing": {
"padding": 100
}
}
}
Resulting card:
As you can see, there is certainly not 100px of padding being added to the card. I've used sample host configs and tweak other settings like colors so I know the config is being applied, but nothing I do seems to affect the card padding. Thanks in advance!
Card JSON:
{
"type": "AdaptiveCard",
"body": [
{
"type": "Container",
"items": [
{
"type": "TextBlock",
"size": "Medium",
"weight": "Bolder",
"text": "Publish Adaptive Card schema"
},
{
"type": "ColumnSet",
"columns": [
{
"type": "Column",
"items": [
{
"type": "Image",
"style": "Person",
"url": "https://pbs.twimg.com/profile_images/3647943215/d7f12830b3c17a5a9e4afcc370e3a37e_400x400.jpeg",
"size": "Small"
}
],
"width": "auto"
},
{
"type": "Column",
"items": [
{
"type": "TextBlock",
"weight": "Bolder",
"text": "Matt Hidinger",
"wrap": true
},
{
"type": "TextBlock",
"spacing": "None",
"text": "Created {{DATE(2017-02-14T06:08:39Z,SHORT)}}",
"isSubtle": true,
"wrap": true
}
],
"width": "stretch"
}
]
}
]
},
{
"type": "Container",
"items": [
{
"type": "TextBlock",
"text": "Now that we have defined the main rules and features of the format, we need to produce a schema and publish it to GitHub. The schema will be the starting point of our reference documentation.",
"wrap": true
},
{
"type": "FactSet",
"facts": [
{
"title": "Board:",
"value": "Adaptive Card"
},
{
"title": "List:",
"value": "Backlog"
},
{
"title": "Assigned to:",
"value": "Matt Hidinger"
},
{
"title": "Due date:",
"value": "Not set"
}
]
}
]
}
],
"actions": [
{
"type": "Action.ShowCard",
"title": "Set due date",
"card": {
"type": "AdaptiveCard",
"body": [
{
"type": "Input.Date",
"id": "dueDate"
},
{
"type": "Input.Text",
"id": "comment",
"placeholder": "Add a comment",
"isMultiline": true
}
],
"actions": [
{
"type": "Action.OpenUrl",
"title": "OK",
"url": "http://adaptivecards.io"
}
],
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json"
}
},
{
"type": "Action.OpenUrl",
"title": "View",
"url": "http://adaptivecards.io"
}
],
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"version": "1.0"
}

Adding new Sensor to Object Model is failing

I am trying to modify the quick sample provided here.
I tried to add a few custom sensor data type but it is failing. Then I tried a few data types mentioned in the documentation which also failed.
I am getting below error
Creating Sensor: {
"DataType": "Noise",
"DeviceId": "some-device-id",
"HardwareId": "SAMPLE_SENSOR_NOISE"
}
Request: POST
https://******.*******.azuresmartspaces.net/management/api/v1.0/sensors
Response Status: 404, NotFound , {"error":
{"code":"404.600.000.001","message":"There is no SensorDataType of the
given name."}}
Can we add custom sensor datatype?
If no then what are the inbuilt data types? or if yes then what went wrong here?
You need to post the DataType when creating the Sensor object. Use “None” if you want to change it later. Swagger DOCs show the “Model” you can expand and see required fields.
If the DataType is not in the api/v1/system/types you will need to enable it or create a new DataType. Create a new DataType POST to the Types with the required information. The minimum is the TypeName and SpaceID to neat the type under. My typical pattern is to create a root space and append any custom twin objects like types to this space.
I believe these are case sensitive names as well.
https://{servicename}.{region}.azuresmartspaces.net/management/swagger/ui/index#/Types
EDIT:
Check your Ontologies with:
https://{servicename}.{region}.azuresmartspaces.net/management/api/v1.0/ontologies
Select these by ID and POST to set them to true to get all available built-in types:
[
{
"id": 1,
"name": "Required",
"loaded": true
},
{
"id": 2,
"name": "Default",
"loaded": true
},
{
"id": 3,
"name": "BACnet",
"loaded": true
},
{
"id": 4,
"name": "Advanced",
"loaded": true
}
]
Then you can query all the given types:
https://{servicename}.{region}.azuresmartspaces.net/management/api/v1.0/types?includes=Description,FullPath,Ontologies,Space
You should receive something like:
[
{
"id": 1,
"category": "DeviceSubtype",
"name": "None",
"disabled": false,
"logicalOrder": 0,
"fullName": "None",
"spacePaths": [
"/system"
],
"ontologies": [
{
"id": 1,
"name": "Required",
"loaded": true
}
]
},
{
"id": 2,
"category": "DeviceType",
"name": "None",
"disabled": false,
"logicalOrder": 0,
"fullName": "None",
"spacePaths": [
"/system"
],
"ontologies": [
{
"id": 1,
"name": "Required",
"loaded": true
}
]
},
{
"id": 3,
"category": "DeviceBlobSubtype",
"name": "None",
"disabled": false,
"logicalOrder": 0,
"fullName": "None",
"spacePaths": [
"/system"
],
"ontologies": [
{
"id": 1,
"name": "Required",
"loaded": true
}
]
},
...Objects,
]

Resources