Survey Monkey API Questions - surveymonkey

I have a couple questions regarding the survey monkey API. First, I've noticed that the categories that can be assigned to open ended questions don't come through when pulling the details of a response. Is there a way to do this and if not, when will it be added?
Secondly, I've attempting to update the metadata field of a response, yet I'm receiving an invalid schema era.
I'm sending this in the request body:
{
"id": "4472927205",
"metadata": { "category" : "test"
}
}
This is the response I receive:
{
"error": {
"http_status_code": 400,
"message": "Invalid schema in the body provided.",
"id": "1002",
"docs": "https://developer.surveymonkey.com/api/v3/#error-codes",
"name": "Bad Request"
}
}
What is the proper schema for a request?

Categories set in the analyze section are not currently accessible through the API. There is no ETA for that at the moment.
Also the metadata shown in the responses are auto-generated based on other factors (some page logic I believe, contact information - case email collector) and are not updateable at the moment either.
See the docs also you can watch the public docs repo to be notified when the changes you'd like have been released.

Related

MS Team[BETA] API for Message object property type for reaction

I am trying to create the schema for Message API
As per the documentation, the sample response properties for reaction provided are below
Documentation sample response
"reactions": [
{
"reactionType": "like",
"createdDateTime": "2019-01-21T19:55:51.893Z",
"user": {
"application": null,
"device": null,
"conversation": null,
"user": {
"id": "e1ecb745-c10f-40af-a9d4-cab946c80ac7",
"displayName": null,
"userIdentityType": "aadUser"
}
}
}
]
From the documentation user is Identity type identity set
Identity is of type:
{
"displayName": "string",
"id": "string",
"tenantId": "string",
"thumbnails": { "#odata.type": "microsoft.graph.thumbnailSet" }
}
From the sample response as well as the response from endpoint, tenantId is not present.
There is a difference in sample response/actual endpoint response and documented properties:
The one with tenantId or one without tenantId.
The user is 1 level as per property documentation but as per actual response and sample response user property has user with in.
What is the correct schema of reaction property that we should consider, because we see variation in documentation vs actual response ?
ok, I think I understand - you're just asking what you should be coding for / expecting, when you query the api. It looks to me like the first link you've posted is the more correct, but you can verify this by using the Graph Explorer. This response does NOT bring back "tenantId", but you haven't explained if you -need- tenantId. If so, there are other ways to get it.
#KritikaVohra, Consider the response that you receive from the https://graph.microsoft.com/beta/teams/{id}/channels/{id}/messages. You don't need tenant id here. in case in conversation if you need it, you can use it from turnContext.

Get the message ID in the survey monkey response

I am using survey monkey v3 API's to send survey emails. While sending a survey email from one collector, I am sending two different survey messages for the same recipient. However, while collecting the survey responses from survey monkey using the api "/surveys/{id}/responses/bulk", I couldn't find the messageID in it. So I how can I find which response belong to which message of the collector then? Is there a different API that I have to use?
What's the use case for tracking the specific message? You have the recipient_id, and first/last/email fields.
You can get recipient details at /collectors/{collector_id}/recipients/{recipient_id}. There's no way (as far as I can tell) to query for this other than searching your messages with /collectors/{collector_id}/messages/{message_id}/recipients
Generally speaking, when you add recipients to a message, they are shared with the collector. Which specific message was responded to is not really tracked, the tracking ID is the recipient_id with respect to the collector.
If you are interested in message stats (ex. which message gets a better response rate) you can use the message stats endpoint.
With regards to having a different message for say different products, unfortunately the message ID is not tied to a response, but two options are:
1) Use a different collector for each product (not ideal if there is a lot)
2) Use extra fields on the recipient (see example):
Example:
POST /v3/collectors/<collector_id>/messages/<message_id1>/recipients
{
"first_name": "Test",
"last_name": "Tester",
"email": "test#example.com",
"extra_fields": {
"product": "shoes"
}
}
POST /v3/collectors/<collector_id>/messages/<message_id2>/recipients
{
"first_name": "Test",
"last_name": "Tester",
"email": "test#example.com",
"extra_fields": {
"product": "shirts"
}
}
Then when you fetch the responses, you'll get that information in metadata, example:
{
"id": "<response_id>",
"recipient_id": "<recipient_id>",
"collector_id": "<collector_id>",
...
"metadata": {
"contact": {
"product": {
"type": "string",
"value": "shoes"
},
"email": {
"type": "string",
"value": "test#example.com"
}
}
}
}
One thing to watch out for is that the extra fields from the contact do not currently show up in the /responses/bulk endpoint, only individual responses/<id> endpoint. Also with extra fields you can't filter responses where product=shoes or whatnot. Those are some limitations with the current API - but hopefully it can at least be helpful for now.

Creating Post with Dynamics CRM Web API

A Post entity (https://msdn.microsoft.com/en-us/library/mt607553.aspx) cannot be created using Dynamics CRM 2016 Online Web API.
This payload should create a post on POST /api/data/v8.1/posts
{
"text": "Test Single Post",
"source": 1,
"type": 7
}
(source 1 is an auto post, type 7 is a status post)
But it returns:
{
"error":
{
"code":"",
"message":"An unexpected error occurred.",
"innererror"
{
"message":"An unexpected error occurred..."
}
}
}
Submitting the same payload with only "text" fails too.
Notice that the Post entity does not have single-valued navigation properties (https://msdn.microsoft.com/en-us/library/mt607553.aspx#bkmk_SingleValuedNavigationProperties) that will allow me to set the related entity (contact, account, etc).
For example, Creating a Task entity (https://msdn.microsoft.com/en-us/library/mt607619.aspx) works fine on POST /api/data/v8.1/tasks
{
"subject": "Test Single Task",
"description": "Test One Description of Task",
"regardingobjectid_contact_task#odata.bind": "/contacts(<someguid>)",
"scheduledend": "2016-07-21T12:11:19.4875892Z"
}
It seems to me that Post should expose something like regardingobjectid_contact_post#odata.bind, but it does not.
For context, this is how to create a Post via the SOAP endpoint and the SDK:
var result = Client.getOrganizationService().Create(new Post
{
Text = post.text,
RegardingObjectId = new EntityReference(
entityName,
Guid.Parse(post.regarding_guid)
)
});
Does anyone have a working example of a Post created via the Web API? Is this an omission in the Dynamics CRM Web API?
It doesn't look like this is listed in the limitations: https://msdn.microsoft.com/en-us/library/mt628816.aspx
UPDATE
It appears that the postregarding entity is where the link should be created to contact/account. This can be demonstrated by querying:
/posts?$filter=postregardingid/regardingobjectid_contact/contactid eq <someguid>
However, a "deep insert" like so does not work:
{
"text":"sometext",
"postregardingid":
{
"regardingobjectid_contact#odata.bind":"/contacts(someguid)"
}
}
The response is
Cannot create child entities before parent entity.
Nowhere it's mentioned like Post (activity feed) cannot be created using webapi. In fact it's not listed as crm webapi limitation like you pointed out.
Also on comparison, _regardingobjectid_value lookup property of post is different from activitypointer. Single valued navigation property too.
Out of curiosity, My investigation moved towards the Partner - post_PostRegardings
Only thing making sense - postregarding is strictly internal use. This could be the reason for all such behavior. This is my theory per v8.2 today(Aug 12 2017)
Description: Represents which object an activity feed post is regarding. For internal use only.
Entity Set path:[organization URI]/api/data/v8.2/postregardings
Base Type: crmbaseentity EntityType
Display Name: Post Regarding
Primary Key: postregardingid
Ref: https://msdn.microsoft.com/en-us/library/mt608103.aspx
Update:
Looks like MS recommend the community to use Organization service to create a custom Post record. Web api is still broken. Read more
I was recently struggling with this issue with an Activity table made using powerapps. For those who are interested, here's my post request:
POST: https://<MY_DOMAIN>.crm.dynamics.com/api/data/v9.1/<TABLE_NAME>
{
"regardingobjectid_contact#odata.bind": "/contacts(xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx)",
"description": "data for this entity",
"subject": "more data"
}
I didn't do anything different from other peoples' answers. I'll give an update if this problem fails sporadically. But as it is right now, it looks like regardingobjectid may be working in version 9.1
using D365 Api v9.1
POST https://{domain}.crm4.dynamics.com/api/data/v9.1/posts
{
"regardingobjectid_contact#odata.bind":"/contacts(guid)",
"text": "This is a private message post",
"source": 1,
"type": 4
}
source :
Auto Post
Manual Post
ActionHub Post
type :
Check-in
Idea
News
Private Message
Question
Re-Post
Status

Get Recommendation from LinkedIn API returns empty map [:] as response

I have created a web application from which I am trying to get recommendations of a user from his/her LinkedIn Profile using URL
String url="https://api.linkedin.com/v1/people/~:(recommendations-received:(id,recommendation-type,recommendation-text,recommender))?format=json"
When I am using this URL in the
Api Explorer it works fine. And gives output:-
{ "recommendationsReceived": {
"_total": 2,
"values": [
{
"id": 558598601,
"recommendationText": "xxx is among the best team players I ever worked with. He has handled client effectively with smooth operations. I had always seen him as person with solution mindset and always look for solution rather than thinking about the problem. ",
"recommendationType": {
"code": "colleague"
},
"recommender": {
"firstName": "XXX",
"id": "YYYY",
"lastName": "XXX"
}
},
{
"id": ZZZZ,
"recommendationText": "XXX is one of the most dedicated person at work.I always him with a flexible attitude and ready to adapt himself in all situation.I have seen him work all night to catch up all the deadlines and deliver on time ."
"recommendationType": {
"code": "colleague"
},
"recommender": {
"firstName": "XXX",
"id": "YYYY",
"lastName": "XXXX"
}
}
] } }
The problem comes, when I am using this URL in my Developer app.It doesn't give any error just simple return an empty map [:] as output in response
Irrespective of these recommendation fields, I successfully get the user basic profile data such as email, id, image,firstName,lastName.Means my code is working for other fields well but not for these recommendation fields*
To find the solution, I did some internet surfing and find a link of Linked API docs
Linked API Docs
As per Docs following selection of profile fields are only available
to applications that have applied and been approved for the Apply with
LinkedIn program:
Recommendation Fields
I already created a LinkedIn Developer account to get key & Secret
So how do I apply and get approval for Apply with LinkedIn Recommendation Fields.
I already have seen the LinkedIn support but can't find the way to ask question to the Linked Developer help support
Please suggest me the right way.
After a long internet surfing,I have found something fruitful that, I have to fill up a form to get these fields.Here is the form
along with its procedural details
You can use just recommendations-received keyword. Try the following link. I am getting all recommendations details with this link.
https://api.linkedin.com/v1/people/~:(recommendations-received)?format=json

"additional properties" error in Survey Monkey API call

I'm trying to use the create_flow endpoint to the Survey Monkey API. It is sending back a status 3 message with the following error:
additional properties not defined by 'properties' are not allowed in field '_data'
I'm able to do successfully use all other API endpoints and have a valid API key and durable OAuth token.
Here's an example JSON body that I'm sending to: https://api.surveymonkey.net/v2/batch/create_flow?api_key=apikeyhere
{
"survey": {
"template_id": "566",
"survey_title": "test1",
"collector": {
"type": "email",
"name": "collector1",
"recipients": [
{
"email": "email#example.com"
}
]
},
"email_message": {
"reply_email": "myemail#example.com",
"subject": "this is a test"
}
}
Note: JSON formatting here is being generated automatically using RJSONIO
Any ideas what might be causing the error? It seems like all fields are correctly named and where they're supposed to be, so I'm not sure what the problem is.
It's a bad error message unfortunately - it's a known issue. It means you are providing extra keys that are not part of the create_flow schema.
The issue here is that the "email_message" and "collector" keys have been nested inside of "survey", instead of being in the main JSON body like the "survey" key. Move them out a level and it should work.

Resources