I try to create a post through the API, but I always get a 403 response code with this body
{“success”:false, “error”: “Pundit::NotAuthorizedError”, “message”: “Access denied”, “backtrace”:[“app/controllers/posts_controller.rb:75:in ‘PostsController#create\’, ‘app/logical/rack_server_timing.rb:19:in \’RackServerTiming#call'”}]}The API key being used has all permissions. I am sending create request with this function
def create_post(media_asset_id, tags, rating, source):
headers = {
'User-Agent': 'MyUploaderQ/1.0'
}
data = {
'upload_media_asset_id': media_asset_id,
'post[tag_string]': tags,
'post[rating]': rating,
'post[source]': source,
}
resp = requests.post(
f'{BASE_URL}/posts.json',
data=data,
auth=(USERNAME, API_KEY),
headers=headers
)
resp.raise_for_status()
return resp.json()['id']
