how to specify a key file (key.json) in the url of creating a googlesheet - rest

i have created a google service account, created a keyfile (key.json) and now I want to create a googlesheet using postman
https://sheets.googleapis.com/v4/spreadsheets?scope=https://www.googleapis.com/auth/spreadsheets&private-key-file=c:\temp\key.json
But I keep getting a 401 error - missing required credential
{
"error": {
"code": 401,
"message": "Request is missing required authentication credential. Expected OAuth 2 access token, login cookie or other valid
authentication credential. See
https://developers.google.com/identity/sign-in/web/devconsole-project.",
"status": "UNAUTHENTICATED"
}
}
what's the syntax to pass the key file in the url/header or body ?
thanks !

just goto authorization header and add the key and value as api key and select add in as "query parameter"
You can also manually add key and value as query parameter
Both does the exact same thing

Related

Using DialogFlow Rest API with API KEY

I'm trying to use DialogFlow REST API with api key auth method. For example
https://dialogflow.googleapis.com/v2/projects/projectId/agent?key=[YOUR_API_KEY]
but It desn't work. This is the result
{
"error": {
"code": 401,
"message": "Request is missing required authentication credential. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.",
"status": "UNAUTHENTICATED"
}
}

Documentum REST API issue

I have successfully installed Documentum REST API in my environment. When I go to http://localhost:8080/dctm-rest/repositories I am able to see the repositories successfully. But when I when I try to open any cabinet URL there, it prompts for username password.
I put a password there and it works fine.
But when I send the request using Postman it shows this error
"status": 401,
"code": "E_GENERAL_AUTHENTICATION_ERROR",
"message": "Authentication failed.",
"details": "Full authentication is required to access this resource"
and when sending with Authorization in the format
Authorization : Basic (base64 value of "username:password")
it shows
"status": 400,
"code": "E_INPUT_ILLEGAL_ARGUMENTS_PARAM",
"message": "Illegal argument {0} provided with value {1}.",
"details": "Parameter conditions \"dql\" not met for actual request
parameters: "
You Have to turn on the Interceptor to make proxy-authenticated request so that it has the same request context as of browser.
I tried few links and used Basic Auth, which worked!

Upload a image to Google Cloud Storage using Rest end point via API-KEY

I am new to Google Cloud. I want to upload an image to my Bucket.
I did it successfully from the GCP Console and GCP Shell. However, I am unable to do it using REST Endpoint using API-KEY.
Here is my URL.
https://www.googleapis.com/upload/storage/v1/b/[MY_BUCKET]/o?uploadType=media&name=myhero&key=[MY_API-KEY]
I am getting the following message
{
"error": {
"errors": [
{
"domain": "global",
"reason": "required",
"message": "Anonymous caller does not have storage.objects.create access to [MY_BUCKET]/myhero.",
"locationType": "header",
"location": "Authorization"
}
],
"code": 401,
"message": "Anonymous caller does not have storage.objects.create access to [MY_BUCKET]/myhero."
}
}
This is because the bucket currently does not allow any way to allow users with the API-KEY even though the API-KEY allows the user of this key to upload an object to the bucket.
What should I do
1) if I want to go with the API-key way.
2) if I want to go with service-account way. What is the best way to generate Authorisation token? I have come till this point
{"alg":"RS256","typ":"JWT"}.
{
"iss":"761326798069-r5mljlln1rd4lrbhg75efgigp36m78j5#developer.gserviceaccount.com",
"scope":"https://www.googleapis.com/auth/prediction",
"aud":"https://www.googleapis.com/oauth2/v4/token",
"exp":1328554385,
"iat":1328550785
}.
But I am unable to generate {Base64url encoded signature} as I am unable to figure out the private and public keys...
You are getting “anonymous caller” because you are not properly authenticated. You can authenticate using a bearer token instead of the API-KEY.
You can run the following script:
BUCKET=<BUCKET_NAME>
OBJECT=<OBJECT>
TOKEN=$(gcloud auth print-access-token)
curl "https://www.googleapis.com/upload/storage/v1/b/$BUCKET/o?uploadType=media&name=$OBJECT" -H"Authorization: Bearer $TOKEN" -H'Content-Type: image/jpg' --data-binary #$OBJECT

Cloud foundry API - stop application

I Need API to stop the running application, after some search I've found this API
http://apidocs.cloudfoundry.org/263/apps/updating_an_app.html
if I want to test it with postman how can I obtain token and where should I put it inside postman ?
Edit
i've tried like following with postman
Put
https://[api]/v2/apps/211c82e2-7316-45b6-9ae6-1df4dzz74772/stop
Header
Authorization : bearer <token>
"Content-Type":"application/x-www-form-urlencoded"
I got error:
{
"description": "Unknown request",
"error_code": "CF-NotFound",
"code": 10000
}
Any idea?
To get the token you can run cf oauth-token from the CLI.
You can use that token in Postman by adding an 'Authorization' HTTP header.
E.g.
Authorization: bearer token_you_got_by_running_cf_oauth-token

Instagram's Rest API "client_id=” not working / is removed or chanced?

I using this call url:
"https://api.instagram.com/v1/tags/cats/media/recent?client_id=MY_CLIENT_ID".
I using client_id because my application type is windows service.
but this url throw this error:
{"meta": {"error_type": "OAuthAccessTokenException", "code": 400, "error_message": "The access_token provided is invalid."}}
what should I do?
Thanks..
you have to authenticate using oauth2 and get access_token and use that to make API calls.
Here is more information:
https://www.instagram.com/developer/authentication/