Getting access forbidden when calling a SendGrid API - sendgrid

Trying to invoke https://api.sendgrid.com/v3/suppression/bounces (https://docs.sendgrid.com/api-reference/bounces-api/retrieve-all-bounces) and I get a message of "access forbidden".
I am passing in a valid API Key, which is from a free new account.
API:
GET
Headers:
Authorization Bearer SG.xxxxxxxxxxxxxxxx
Accept application/json
Response:
{
"errors": [
{
"field": null,
"message": "access forbidden"
}
]
}

Related

I keep getting error 404 when creating a new document archive

I am testing the Clio API through Postman but I keep getting error 404 when I tried creating a new document. Below is the sample request.
POST https://app.clio.com/api/v4/document_archives.json?fields=id,size,progress,state
Content-Type: application/json
Authorization: Bearer ****
Body
{
"data": {
"items": [
{
"id": 5998571944,
"type": "Folder"
}
]
}
}

How I can get authentication token or do loging in Elastic Search using REST API? For example from POSTMAN

I'm trying to list data from Elastic Search using the REST API on Postman.
But I get a security_exception error
I read the elastic documentation at https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-get-token.html
but didn't work.
I'm using Elastic 7.2
Method: POST
Content-type: Application/json
URI: http://xxx.xxx.xxx.xxx:9200/_security/oauth2/token
BODY:
{
"grant_type" : "password",
"username" : "user_name",
"password" : "correct_password"
}
I need this service to return the authentication token. But this is the response:
{
"error": {
"root_cause": [
{
"type": "security_exception",
"reason": "missing authentication credentials for REST request [/_security/oauth2/token]",
"header": {
"WWW-Authenticate": "Basic realm=\"security\" charset=\"UTF-8\""
}
}
],
"type": "security_exception",
"reason": "missing authentication credentials for REST request [/_security/oauth2/token]",
"header": {
"WWW-Authenticate": "Basic realm=\"security\" charset=\"UTF-8\""
}
},
"status": 401
}
Try to do a basic authentication instead. And pass in the body just the grant_type.

Unable to get CPM data from Youtube Analytics account

I'm unable to get CPM data from my Youtube reports:
I'm getting:
{
"error": {
"code": 403,
"message": "Forbidden",
"errors": [
{
"message": "Forbidden",
"domain": "global",
"reason": "forbidden"
}
]
}
}
I don't even know where to begin to debug this, and I haven't found anything online.
I'm just trying to curl the endpoint, mirroring this: HERE
Notice that once you finish the oauth process, User will see
"You do not have permission to execute this method." and the 403
Also, Notice if you remove 'CPM' from the list of metrics, this will work.
Example:
curl --header "Authorization: Bearer _____access_token____" -e "https://developers.google.com" https://content-youtubeanalytics.googleapis.com/v2/reports\?endDate\=2014-06-30\&ids\=channel%3D%3DMINE\&metrics\=cpm\&startDate\=2014-05-01\&key\=_____api_key____
I'm getting the refresh token via:
<script>
var auth2;
var SCOPE = ['https://www.googleapis.com/auth/adwords',
'https://www.googleapis.com/auth/yt-analytics.readonly',
'https://www.googleapis.com/auth/youtube',
'https://www.googleapis.com/auth/yt-analytics-monetary.readonly',
'https://www.googleapis.com/auth/youtubepartner-channel-audit',
'https://www.googleapis.com/auth/youtubepartner',
'https://www.googleapis.com/auth/youtube.readonly',
] ;
function initClient() {
auth2 = gapi.auth2.init({
'clientId': 'my-client-id',
'scope': SCOPE.join(' '),
'prompt': 'consent',
})
}
function handleClientLoad() {
gapi.load('auth2', initClient);
}
</script>
<script async defer src="https://apis.google.com/js/api.js"
onload="this.onload=function(){};handleClientLoad()"
onreadystatechange="if (this.readyState === 'complete') this.onload()">
</script>
the access token I'm using is from the refresh token via:
https://www.googleapis.com/oauth2/v4/token?client_id={my_client_id}&client_secret={my_client_secret}&refresh_token={my_refresh_token}&grant_type=refresh_token
and I'm getting:
{
"access_token": "ya29.GlvyBZVPpC.....",
"token_type": "Bearer",
"expires_in": 3600,
"scope": "https://www.googleapis.com/auth/youtubepartner https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/adwords https://www.googleapis.com/auth/youtube https://www.googleapis.com/auth/plus.me https://www.googleapis.com/auth/youtube.readonly https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/yt-analytics.readonly https://www.googleapis.com/auth/yt-analytics-monetary.readonly",
"id_token": "eyJhbGciOiJSUz...."
}
I don't believe it's an issue with my scopes as I am not getting a 403 like:
{
"error": {
"code": 403,
"message": "Request had insufficient authentication scopes.",
"errors": [
{
"message": "Request had insufficient authentication scopes.",
"domain": "global",
"reason": "forbidden"
}
],
"status": "PERMISSION_DENIED"
}
}

MS Graph Rest API Errors

I am getting the following errors for most of the resources in MS Graph.
Also the same resources are working fine with graph explorer ( https://graph.microsoft.io/en-us/graph-explorer ) using dummy tenant.
For POST /users
and PATCH /users
Status Code: 403
{
"error": {
"code": "Authorization_RequestDenied",
"message": "Insufficient privileges to complete the operation.",
"innerError": {
"request-id": "62c7e8f5-386a-4d15-8e94-5408d81b1383",
"date": "2017-01-24T09:08:46"
}
}
}
GET /drives
GET me/drive
Status Code: 500
{
"error": {
"code": "InternalServerError",
"message": "Unable to resolve template token",
"innerError": {
"request-id": "82ab9b86-7a90-4f86-877a-3ddb03ae1d71",
"date": "2017-01-24T09:12:35"
}
}
}
GET me/messages
GET me/events
GET me/mailFolders
GET me/contacts
Status Code: 504
{
"error": {
"code": "UnknownError",
"message": "",
"innerError": {
"request-id": "678af389-cc38-4f5c-9b41-07595e62eee3",
"date": "2017-01-25T06:48:30"
}
}
}
Here is the list of scopes I have included.
"scope": "Calendars.Read Calendars.Read.Shared Calendars.ReadWrite Calendars.ReadWrite.Shared Contacts.Read Contacts.Read.Shared Contacts.ReadWrite Contacts.ReadWrite.Shared Directory.AccessAsUser.All Directory.Read.All Directory.ReadWrite.All email Files.Read Files.Read.All Files.Read.Selected Files.ReadWrite Files.ReadWrite.All Files.ReadWrite.AppFolder Files.ReadWrite.Selected Group.Read.All Group.ReadWrite.All IdentityRiskEvent.Read.All Mail.Read Mail.Read.Shared Mail.ReadWrite Mail.ReadWrite.Shared Mail.Send Mail.Send.Shared MailboxSettings.ReadWrite Notes.Create Notes.Read Notes.Read.All Notes.ReadWrite Notes.ReadWrite.All Notes.ReadWrite.CreatedByApp offline_access openid People.Read profile Sites.Read.All Tasks.Read Tasks.Read.Shared Tasks.ReadWrite Tasks.ReadWrite.Shared User.Read User.Read.All User.ReadBasic.All User.ReadWrite User.ReadWrite.All"

Google cloud storage client api not working for patch

I tried updating header of an object by using API explorer (as well as client library) by giving metadata object as header keys and values.
I only received error respond
{
error": {
"errors": [
{
"domain": "global",
"reason": "invalid",
"message": "Invalid argument."
}
],
"code": 400,
"message": "Invalid argument."
}
}
The request is:
PATCH https://www.googleapis.com/storage/v1beta2/b/mbi-figure/o/infovilla_paypal.png?key={YOUR_API_KEY}
Content-Type: application/json
Authorization: Bearer ya29
X-JavaScript-User-Agent: Google APIs Explorer
{
"metadata": {
"title": "Kyaw"
}
}
You've run into a bug with PATCH that is being worked on. Fortunately, there's a workaround. Adding a "projection=full" parameter to the URL should fix your problem.