Drupal 8 has a REST resource for all content type "Content" and let us to specified settings for all of content type in admin/config/services/rest/resource/entity%3Anode/edit
,but is globally, I mean if let users post data to Content type, they can Post data to all of content types and(But what I need is I don't let them to do this), I didn't find any option to restrict to specified content type.
I also take a look at permission and RESTful Web Services permission is for "Access POST on Content resource" and there is not any option for content types individually.
I want to know how can achieve this that REST POST feature exists for specified content type(s) and for some content type GET exists and for some content type REST not allowed?
Update(more deatils about what I want)
I want anonymous user can POST contenttype1 content with REST ,
I give permission to anonymous user to create contenttype1 content, and
Authentication providerssection I check
cookieand
basic_auth` methods, but when try to post data with following code it told me authentication required
(I ran this snippet in browser console )
(function($){
jQuery.ajax({
url: '/rest/session/token',
method: 'GET',
success: function (token, status, xhr) {
var postData = {}
postData.title = [{'value': 'My Basic Page'}];
postData.field_enroll_email = [{'value': '[email protected]'}];
postData.type = 'enroll';
jQuery.ajax({
url: "/entity/node",
method: "POST",
data: JSON.stringify(postData),
headers: {"Accept": "application/json", "X-CSRF-Token": token, "Content-Type": "application/json"},
success: function (data, status, xhr) {
console.log(data);
}
});
}
});
})(jQuery);