Sending a DELETE request to the Blogger REST API (v3.0), I am trying to delete a post using the delete method . For this, I use the following code:
api_uri = 'https://www.googleapis.com/blogger/v3/blogs/%s/posts/%s' % (blogId, postId)
result = urlfetch.fetch(url=api_uri,
method=urlfetch.DELETE,
headers={'Authorization' : oauth_token})
self.response.out.write(result.content)
But the server returns:
{
"error": {
"errors": [
{
"domain": "global",
"reason": "notFound",
"message": "Not Found"
}
],
"code": 404,
"message": "Not Found"
}
}
However, I can get information about this message using the following code:
api_uri = 'https://www.googleapis.com/blogger/v3/blogs/%s/posts/%s' % (blogId, postId)
result = urlfetch.fetch(url=api_uri,
headers={'Authorization' : oauth_token})
self.response.out.write(result.content)
At the moment, I canβt understand what Iβm doing wrong - the request is allowed blogIdand postIdtrue, but in any case, the server returns a "not found" error.
If you know how to solve this problem, or you can give useful advice - please help me.
Thank you for your time and attention to this matter.
UPD 1: If I send requests to the following URLs:
# https:
# https:
:
{
"error": {
"errors": [
{
"domain": "global",
"reason": "notFound",
"message": "Not Found"
}
],
"code": 404,
"message": "Not Found"
}
}
UPD 2: , OAuth 2.0 . , , https://accounts.google.com/o/oauth2/token JWT:
jwt_claim_set = {
'iss' : '{id}@developer.gserviceaccount.com',
'scope' : 'https://www.googleapis.com/auth/blogger',
'aud' : 'https://accounts.google.com/o/oauth2/token',
'exp' : expire,
'iat' : timestamp
}
:
{
"access_token" : "1/8xbJqaOZXSUZbHLl5EOtu1pxz3fmmetKx9W8CV4t79M",
"token_type" : "Bearer",
"expires_in" : 3600
}
oauth_token, :
data = simplejson.loads(result.content)
oauth_token = data['token_type'] + ' ' + data['access_token']