0

I have enabled the following modules on the site: VotingApi, Like&DisLike, Rest, RestUI and other depending modules

I use POSTMAN as my client and write my GET and POST request from it.

I have Resource "Content" and "Vote" enabled with all methods, auth and format.

I have created a REST Export view of the content and vote.

When I try to GET and/or POST to create a content I was able to do it successfully.

But when I use POST to vote on the content, I get a 403 response. I have provided a correct credentials on it, with header same as content has.

In Drupal browser logs, it says:

Type    access denied
Date    Friday, June 30, 2017 - 07:12
User    Anonymous (not verified)
Location    http://example.com/entity/vote
Referrer    
Message /entity/vote
Severity    Warning
Hostname    172.17.0.1

Here is my POST request:

{
    "type": [
        {
            "target_id": "like"
        }
    ],
    "entity_id": [
        {
            "target_id": 2
        }
    ],
    "value": [
        {
            "value": 1
        }
    ],
    "value_type": [
        {
            "value": "points"
        }
    ],
    "user_id": [
        {
            "target_id": 1
        }
    ]
}
0

You probally haven't added permissions for anonymous user to do a GET/POST request to the given endpoint. Go to permissions, search for rest and enable "Access GET on [rest resource]" (Access GET on Node rest resource resource)

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.