I am using Drupal 8. I have installed the Rest module. I need to do polling so I also installed the Poll module. I created two questions with choices in poll and after that I created a view to show polls in that view with Rest Export enabled.
Now there are 3 fields I am showing in my REST export:
- Question
- Choice
- PollID
currently I have two questions and their choices. Here is how its showing in JSON form.
[{"question":"which is best city",
"choice_target_id":"Delhi, Mumbai, Chennai","id":"1"},
{"question":"Where do you work?",
"choice_target_id":"Flat, Hotel, Factory, Shop","id":"2"}]
But the thing is when I access the REST URL in my browser window where I am logged in it shows all the field as.
[
{"question":"which is best city",
"choice_target_id":"Delhi, Mumbai, Chennai","id":"1"},
{"question":"Where do you work?",
"choice_target_id":"Flat, Hotel, Factory, Shop","id":"2"}
]
But when I am not login and when I then call the REST URL from Postman I get this:
[
{
"question": "which is best city",
"choice_target_id": "",
"id": "1"
},
{
"question": "Where do you work?",
"choice_target_id": "",
"id": "2"
}
]
choice_target_id
is blank. What can be the reason of it?