I'm trying to get my groups where I owner, so I'm trying to perform a GET request on
GET
https://api.linkedin.com/v2/groupMemberships?q=member&member={person URN}&membershipStatuses=List(MEMBER,OWNER)
But I'm getting the following error:
{
"serviceErrorCode": 0,
"message": "Invalid query parameters passed to request",
"status": 400
}
My request to "Marketing Developer Platform" was approved and I am putting the headers in the request:
X-Restli-Protocol-Version: 2.0.0
Authorization: Bearer {{accessToken}}
In the parameter
member={person URN}
I am sending.
member=urn:li:person:{{accountId}}
What am I doing wrong?
Related
I'm playing around with the new firebase auth emulator (on the node admin SDK), and have made some tests that run perfectly if I manually delete the created users between each test, but I can't seem to automatically delete them?
I've used the endpoint defined here in my beforeEach(), but I get an "Response code 401, unauthorized" back from the response call?
Endpoint: delete: http://localhost:9099/emulator/v1/projects/{project-id}/accounts
I just tried using Postman to send the call, and it responded with the following:
{
"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.",
"errors": [
{
"message": "Login Required.",
"domain": "global",
"reason": "required",
"location": "Authorization",
"locationType": "header"
}
],
"status": "UNAUTHENTICATED"
}
}
The URL in the error didn't seem to give me much help beyond adding a google button to a web app, which pointed me to creating an OAuth2 web account. I entered the localhost:9099 into my existing one, but don't know where I should use the client ID and the client secret? If they are what I should use at all.
I know I need some sort of Authorization header for the delete call, but I just don't get what I should put in that header, or how.
Thank you for any insight into this.
Edit: I've now tried the following Authorization headers:
"admin"
"" (an empty string)
The full token generated by firebase.options.credential.getAccessToken()
The access_token field of the above token
The id_token field of the above token.
The token itself looks like this (redacted some fields):
{
"access_token":
"[access token string here]",
"expires_in": 3599,
"scope":
"openid https://www.googleapis.com/auth/firebase https://www.googleapis.com/auth/cloud-platform https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/cloudplatformprojects.readonly",
"token_type": "Bearer",
"id_token":
"[id token string here]"
}
Thanks! However, I wanted using this with a curl format to get this on a npm script, so here is what I used:
curl -H 'Authorization: Bearer owner' -X DELETE http://localhost:9099/emulator/v1/projects/<projectid>/accounts
the response should be:
{}
I figured it out! When the admin generates a token, I use the access_token field part of this token and add the header Authorization: 'Bearer' + access_token to the delete request. Thanks for the help.
(This is an emulator-only endpoint)
Edit: I could just use the string "owner" as the token... Took me a while to get that, but now it works.
I was trying to use fax API of RingCentral on Sandbox URL using REST client:
https://platform.devtest.ringcentral.com/restapi/v1.0/account/~/extension/~/fax
with following:
Authorization: Bearer {{my access_token}}"
Content-Type: application/json
{
"to": [{
"phoneNumber": "<my phone number>"
}],
"faxResolution": "High",
"sendTime": "2019-02-20T09:30:10.800Z"
}
But getting Bad Request issue from the fax API:
status code=400 content type=application/json;
{
"message": "Bad Request",
"errors": []
}
The issue clearly shows the contentType or fax MIME body...
Since the fax api support attachments as data. 400 Bad request error is caused due to wrong content or mime type
Content-Type: multipart/mixed
The API allows sending a fax message with a multipart request, incorporating two or more parts.
ref: https://developers.ringcentral.com/api-reference#
Following reference has described the same:
https://forums.developers.ringcentral.com/questions/517/weird-boundary-in-presence-response-when-requestin.html
https://forums.developers.ringcentral.com/questions/614/switching-to-f-form-option-for-posting-multipartmi.html?page=2&pageSize=10&sort=oldest
I am following the docs https://developers.google.com/calendar/v3/push#creating-notification-channels
I am trying to setup my channel to watch for changes to events, using postman I am posting to:
https://www.googleapis.com/calendar/v3/calendars/xxx/events/watch
[{"key":"id","value":"xxx#xxx.co.uk"},
{"key":"type","value":"web_hook"},
{"key":"address","value":"https://xxx.firebaseapp.com"},{"key":"key","value":"AIzaSyBkAEZGoQwB0f-Kmq4mCCzm93422up8oQw"}]
I keep getting the error below:
{
"error": {
"errors": [
{
"domain": "global",
"reason": "required",
"message": "Login Required",
"locationType": "header",
"location": "Authorization"
}
],
"code": 401,
"message": "Login Required"
}
}
Any ideas why I am getting this? I can fetch data from the API ok.
You are getting the 401 "login required", it means that you are using an expired or invalid access.
Check this Google group discussion on how the process was done on getting the refresh token using the client ID and client secret to implement the authenticated and authorized API calls.
See also references:
Google calendar API returns error 401 'login required' on inserting event in public calendar
Error with Google Calendar API - 401 Login required when adding a calendar event
Using API Key to authenticate a request generates a 401 error
I'm Trying to push notification from postman to firebase for testing
I posted using documentation tips and response is success but nothing sent to my android device .. I tested my code using debugging and firebase console and it working well but when i used postman nothing happens
This is my posting format
http://fcm.googleapis.com/fcm/send
Content-Type : application/json
Authorization: key=AAAAitv2sYo:APA91bENlw37p5pa7pMIKoVv8CroevA7tK3tVFNGUchhGf_zkeKVFdQeYcKQmxsg-2ZOkNHMAvloRjTugmZHzNBa_TLMR2_7lffglJvrKHT1TNixHxtXZimWi2f7c16M2M7ic2S5g1gC
{
"notification" :
{
"body" : "hello",
"title": "firebase",
"sound": "default"
},
"to" : "AAAAitv2sYo:APA91bENlw37p5pa7pMIKoVv8CroevA7tK3tVFNGUchhGf_zkeKVFdQeYcKQmxsg-2ZOkNHMAvloRjTugmZHzNBa_TLMR2_7lffglJvrKHT1TNixHxtXZimWi2f7c16M2M7ic2S5g1gC"
}
i used authorization and to is the same key " server key "
and the response is
{
"multicast_id": 9063339683658826188,
"success": 1,
"failure": 0,
"canonical_ids": 0,
"results": [
{
"message_id": "0:1533133178192931%0000000000000000"
}
]
}
Note : When i write https posting is failed and got Could not get any
response error when i made it http it get the above response
another question .. can i see the sent message in firebase console ?
The Authorization key in the header and the to property in the message have different purposes and are never the same value.
The Authorization key validates your request to the Firebase server. Its value is the "Server key" shown in the Cloud Messaging tab of your Project settings at the Firebase console.
The message to value is the registration ID of the device to which you are sending the message. It is obtained from a call to a client-side SDK.
//body its like this
{
"to":
"/topics/NEWS"
,
"data":{
"extra_information": "This is some extra information"
},
//notification that i need to give
"notification":{
"title": "ChitChat Group",
"text": "You may have new messages",
"click_action":"ChatActivity"
}
}
The 401 error pertains that your Authorization Key is invalid or incorrect.
When using Postman, add a key= prefix for the value of Authorization, like so:
key=AAA...
See below for a tutorial on Sending Downstream FCM Messages using Postman.
Also, for your notification message payload, text isn't one of the valid parameters, I think you were looking for message instead.
Sending Downstream Messages using Postman
To do this in Postman, you simply have to set the following:
Set request type to POST
In the Headers, set the following:
Content-Type = application/json
Authorization = < Your FCM Server Key > (See your Firebase Console's Cloud Messaging Tab)
Set the payload parameters in the Body (*in this example, we used the raw option, see screenshot (2)*)
Send the request to https://fcm.googleapis.com/fcm/send
Screenshots:
(1)
Note: Always keep your Server Key a secret. Only a portion of my key is visible here so it should be fine.
(2)
(3)
Notice that the request was a success with the message_id in the response.
Wrong:
Authorization:AIzaSyDDk77PRpvfhh......
Correct:
Authorization:key=AIzaSyDDk77PRpvfhh......
Full example:
https://fcm.googleapis.com/fcm/send
Content-Type:application/json
Authorization:key=AIzaSyZ-1u...0GBYzPu7Udno5aA
{ "data": {
"score": "5x1",
"time": "15:10"
},
"to" : "bk3RNwTe3H0:CI2k_HHwgIpoDKCIZvvDMExUdFQ3P1..."
}
While the answers above are still correct, you may choose to use HTTP v1. This requires Bearer instead of key= and uses an Oauth2 access token instead of a server key string. To view HTTP v1 specifications, please refer to the link below:
https://firebase.google.com/docs/cloud-messaging/migrate-v1
I was also getting same error in PHP , solved with below header :
$header = array("authorization: key=" . $this->apiKey . "","content-type: application/json");