[英]Create and Share bucket in google cloud storage using google api's
i need to create and share a bucket in gcloud storage using google api's. 我需要使用Google api在gcloud存储中创建和共享存储桶。 but i got an error when am tring with postman(rest client).
但是当我和邮递员(其他客户)一起旅行时遇到错误。
Iam trying with 我尝试
url
-------
https://www.googleapis.com/storage/v1/b?project=testproject
request body
------------
{
"name":"testbucketmanafnew"
}
i got an error 我有一个错误
{
"error": {
"errors": [
{
"domain": "global",
"reason": "required",
"message": "Login Required",
"locationType": "header",
"location": "Authorization"
}
],
"code": 401,
"message": "Login Required"
}
}
after iam created an access tocken using OAuth 2.0 Playground. 在iam使用OAuth 2.0 Playground创建访问令牌后。 And added to header
并添加到标题
Authorization = ya29.VALUE_REDACTED
But i got error 但是我有错误
{
"error": {
"errors": [
{
"domain": "global",
"reason": "authError",
"message": "Invalid Credentials",
"locationType": "header",
"location": "Authorization"
}
],
"code": 401,
"message": "Invalid Credentials"
}
}
what did i miss? 我错过了什么?
using Google api explorer, am able to call api's successfully 使用Google api资源管理器,能够成功调用api
POST https://www.googleapis.com/storage/v1/b?project=testproject&key={YOUR_API_KEY}
{
"name": "testmanafcjbucketyy"
}
Authorization needs to be passed in the following format . 授权需要以以下格式传递。
Authorization: Bearer [oauth2_token]
if you're using Postman the "Header" field becomes Authorization and the "Value" field becomes Bearer[WHITESPACE][oauth2_token] 如果您使用的是邮递员,则“标头”字段将变为“授权”,而“值”字段将变为Bearer [WHITESPACE] [oauth2_token]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.