Data missing in extra_fields in /collectors/{id}/recipients - surveymonkey

I am trying to get the response with this query from SurveyMoneky:
/collectors/{id}/recipients?include=survey_response_status,mail_status,custom_fields,remove_link,extra_fields,survey_link
Response I am getting is:
"last_name": "Siraj",
"first_name": "Abdullah",
"survey_response_status": "completely_responded",
"mail_status": "sent",
"email": "***",
"href": "****",
"custom_fields": {
"1": null,
"6": "2017"
},
"remove_link": "****",
"id": "3310118350",
"survey_link": "****"
My problem is:
I am supposed to get the extra_fields which I am not receiving
custom_field 1 is definitely not null, its wrong data.
The actual values of those fields are:
"extra_fields": {
"job_item_id": "123456",
"year": "2017"
},
"custom_fields": {
"1": "123456",
"6": "2017"
}
I checked with this call: /collectors/{id}/recipients/{id} and this works fine.
Am I missing something?

Related

Odata PageResult response property names are changed after upgrading to 8.0.11 for NET 3.1 to NET 6.0 migration

Have below code to generate page result to get below expected result but i am getting below current result. Client using this end point is breaking as there are no items,nextpagelink and count available after upgrading the framework to net6 and odata to 8.0.11
Expected Result :
{
"items": [
{"id":6975,"name":"Dummy Value","phone":"999999999","fax":null,"address":"Dummy street","city":"Some","state":"some","zipCode":"99999","countryId":1}],
"nextPageLink":"/Vendors?$filter=zipCode%20eq%20%2785022%27&$orderby=name%20asc&$skip=50",
"count":null
}
Current Result :
{
"#odata.context": "http://localhost:8080/$metadata#Vendors",
"value":
[
{
"id": 6975,
"name": "Dummy Value",
"phone": "999999999",
"fax": null,
"address": "Dummy",
"city": "Some",
"state": "Some",
"zipCode": "99999",
"countryId": 1
}
],
"#odata.nextLink": "/Vendors?$filter=zipCode%20eq%20%2799999%27&$orderby=name%20asc&$skip=50"
Controller Code:
Start up.cs :
Expected Result :
{
"items": [
{"id":6975,"name":"Dummy Value","phone":"999999999","fax":null,"address":"Dummy street","city":"Some","state":"some","zipCode":"99999","countryId":1}],
"nextPageLink":"/Vendors?$filter=zipCode%20eq%20%2785022%27&$orderby=name%20asc&$skip=50",
"count":null
}
Current Result :
{
"#odata.context": "http://localhost:8080/$metadata#Vendors",
"value":
[
{
"id": 6975,
"name": "Dummy Value",
"phone": "999999999",
"fax": null,
"address": "Dummy",
"city": "Some",
"state": "Some",
"zipCode": "99999",
"countryId": 1
}
],
"#odata.nextLink": "/Vendors?$filter=zipCode%20eq%20%2799999%27&$orderby=name%20asc&$skip=50"

I want to hide the user id with devise-token-auth (I want it not to be included in the response)

Premise
ruby 2.7.5
Rails 6.1.6.1
devise (4.8.1)
devise_token_auth (1.2.0)
What I want to achieve
When registering and logging in with devise-token-auth, I want to avoid including the id in the response.
Current registration response
{
"status": "success",
"data": {
"id": 1,
"provider": "email",
"uid": "test#example.com",
"allow_password_change": false,
"name": null,
"email": "test#example.com",
"created_at": "2022-08-14T08:20:24.396Z",
"updated_at": "2022-08-14T08:20:24.453Z"
}
}
Ideal response
{
"status": "success",
"data": {
"provider": "email",
"uid": "test#example.com",
"allow_password_change": false,
"name": null,
"email": "test#example.com",
"created_at": "2022-08-14T08:20:24.396Z",
"updated_at": "2022-08-14T08:20:24.453Z"
}
}

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.

Schema definition in Swagger

I'm very new to OpenAPI and I'm using http://editor.swagger.io to design an API.
I'm stuck in Schema with a JSON looking like following
{
"CORRELATION_ID": "10",
"CONTROL":
{
"DAS_IS_RECIPIENT": "123",
"DOCTPYE": "ert",
"PROCESS_INDICATOR": "nord"
},
"HEADER":
{
"ID": "456",
"INVOICE_NUMBER": "678",
"DMS_DOC_ID": "876",
"INVOICE_DATE": "10082020"
},
"ITEMS": [
{
"SHORT_TEXT": "123",
"LSTAR": 0,
"QUANTITY": "23"
},
{
"SHORT_TEXT": "456",
"LSTAR": 234,
"QUANTITY": "21"
}
],
"DEBITOR":
{
"ID": "444",
"FIRSTNAME": "nick",
"LASTNAME": "cantre"
},
"CREDITOR":
{
"ID": "454",
"FIRSTNAME": "ava",
"LASTNAME": "pierre"
}
}
How to create a schema according to this JSON structure?

How to parse JSON without root key

I tried searching but couldn't find any proper solution for this. I am trying to parse JSON using the RestClient gem in Ruby without a root key. When I parse it, it returns blank values.
This is the sample JSON I am trying to parse.
[
{
"id": 1,
"name": "Leanne Graham",
"username": "Bret",
"email": "Sincere#april.biz",
"address": {
"street": "Kulas Light",
"suite": "Apt. 556",
"city": "Gwenborough",
"zipcode": "92998-3874",
"geo": {
"lat": "-37.3159",
"lng": "81.1496"
}
},
"phone": "1-770-736-8031 x56442",
"website": "hildegard.org",
"company": {
"name": "Romaguera-Crona",
"catchPhrase": "Multi-layered client-server neural-net",
"bs": "harness real-time e-markets"
}
},
{
"id": 2,
"name": "Ervin Howell",
"username": "Antonette",
"email": "Shanna#melissa.tv",
"address": {
"street": "Victor Plains",
"suite": "Suite 879",
"city": "Wisokyburgh",
"zipcode": "90566-7771",
"geo": {
"lat": "-43.9509",
"lng": "-34.4618"
}
},
"phone": "010-692-6593 x09125",
"website": "anastasia.net",
"company": {
"name": "Deckow-Crist",
"catchPhrase": "Proactive didactic contingency",
"bs": "synergize scalable supply-chains"
}
}
]
I get the proper output, but when I try to access specific fields, I get blank output:
require 'rest-client'
output = RestClient.get 'https://jsonplaceholder.typicode.com/users'
puts output
puts output[0]["username"]
I get no output for username.
rest-client does not parse the JSON itself. You need to do this as an explicit step:
require 'rest-client'
response = RestClient.get('https://jsonplaceholder.typicode.com/users')
output = JSON.parse(response.body) # or just JSON.parse(response) would also work
puts output[0]["username"]

Resources