UGC posts for showing company post from linkedIn for GET method - api

I have used postman with this curl request
curl -X GET 'https://api.linkedin.com/v2/ugcPosts?q=authors&authors=List({urn:li:organization:77ilp7ense0pbf})&sortBy=LAST_MODIFIED' \
-H 'X-Restli-Protocol-Version: 2.0.0' \
-H 'Authorization: Bearer {AQXONiuOuqTCGgEeH3NJBA9b7A8NPbdS5nFjp7nAxUUBnmVmo53UzamJDksan3WSduiUE6u39J9PJNtRVvLhn}'
I have added {urn:li:organization:77ilp7ense0pbf}, "77ilp7ense0pbf" is my client ID.
I have added 'Authorization: Bearer {AQXONiuOuqTCGgEeH3NJBA9b7A8NPbdS5nFjp7nAxUUBnmVmo53UzamJDksan3WSduiUE6u39J9PJNtRVvLhn}' as my access token.
But still i am getting this error
{
"serviceErrorCode": 65600,
"message": "Invalid access token",
"status": 401
}
Is there anything i missed here ? Or any configuration is wrong. Please let me know to get the company posts by UGC posts. I have to get all my linkedIn posts from my company page. https://www.linkedin.com/company/blenheim-chalcot-it-services-india-private-limited/posts/
Thanks in advance.

To get all posts use https://api.linkedin.com/v2/posts like here and to retrieve some statics about share go here

Related

Getting 403 Forbidden Error While Accessing Google Chrome Web Store API

We have a chrome extension in Google web store under my Google user id and I want to give API access to my colleagues (in the same organization). I am following this guide but it is not allowing me to access API. Here is exactly what I did
Created a Google Cloud console project using the email id that is
used to access the chrome store
Enabled Google Chrome Web Store API
Generated Oauth credentials as described in the link
Added my colleagues email address as test users under Oauth Consent section
Generated the "code" as described in the link using Colleague's Google ID
Successfully got the token by sending the curl request as described in the instructions above
Sent a curl API GET request using the token as shown below
curl \
-H "Authorization: $TOKEN" \
-H "x-goog-api-version: 2" \
-H "Content-Length: 0" \
-H "Expect:" \
-X GET \
-v \
https://www.googleapis.com/chromewebstore/v1.1/items/ITEM_ID?projection=DRAFT
The response I get is this
{
"error": {
"code": 403,
"message": "Forbidden",
"errors": [
{
"message": "Forbidden",
"domain": "global",
"reason": "forbidden"
}
]
}
}
Any idea on what I am missing here?
https://www.googleapis.com/chromewebstore/v1.1/items/ITEM_ID?projection=DRAFT
The Authorization header is missing the token type: Bearer
-H "Authorization: Bearer $TOKEN"

chalice-cognito-auth obtained id_token but still getting "User is not authorized"

Try to use https://pypi.org/project/chalice-cognito-auth/
I was able to get a json response like:
{"id_token":"eyJra...sda",
"refresh_token":"eyJjd...",
"access_token":"eyJraWQiO...",
"token_type":"Bearer"}
But when I try to use it like
curl -H "Authorization: id_token value ..." http://127.0.0.1:8000/whoami
It replied
{
"Message": "User is not authorized to access this resource"
}
Try this, curl -H "Authorization: Bearer id_token" http://127.0.0.1:8000/whoami
i.e., you missed the Bearer keyword.

Hitting the GitHub api for listing PR comments returns no result

I want to list (count actually) the comments made on a GitHub pull request.
As per the documentation, I am using the following curl command to hit the GitHub API
curl -H "Accept: application/vnd.github+json" -H "Authorization: token abcdefg123457" https://api.github.com/repos/MyOrg/MyRepo/pulls/2/comments
The result is the following:
[
]
despite me seeing comments on #PR2.
What am I missing?

Waste Management API - Authorization: Bearer problem

Im reading this documentation:
https://api.wm.com/howtotest/#make-an-api-call
And I want to make this test request in the postman:
curl -i https://apitest.wm.com/v1/helloworld \
-H "Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJhbnlvbmVAYW55LmNvbSIsInN1YiI6Ildhc3RlIG1hbmFnZW1lbnQgIHRlYW0iLCJqdGkiOiIwQkQyRTVDQkM2RDE2Mzc0RkNFQSIsInNjb3BlIjpbInNlbGYiLCJoZWxsb3dvcmxkIl0sImlhdCI6MTQ5MDg5ODk1NSwiZXhwIjoxNTIyNDM0OTU1fQ.O2k-senypXFZQwW4Ln3mBg60qzOSo-diPQWVfir3m6Q" \
-H "ClientId: 0BD2E5CBC6D16374FCEA" \
-H "Request-Tracking-Id: 12132"
But i recived response like this:
{
"message": "'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJhbnlvbmVAYW55LmNvbSIsInN1YiI6Ildhc3RlIG1hbmFnZW1lbnQgIHRlYW0iLCJqdGkiOiIwQkQyRTVDQkM2RDE2Mzc0RkNFQSIsInNjb3BlIjpbInNlbGYiLCJoZWxsb3dvcmxkIl0sImlhdCI6MTQ5MDg5ODk1NSwiZXhwIjoxNTIyNDM0OTU1fQ.O2k-senypXFZQwW4Ln3mBg60qzOSo-diPQWVfir3m6Q' not a valid key=value pair (missing equal-sign) in Authorization header: 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJhbnlvbmVAYW55LmNvbSIsInN1YiI6Ildhc3RlIG1hbmFnZW1lbnQgIHRlYW0iLCJqdGkiOiIwQkQyRTVDQkM2RDE2Mzc0RkNFQSIsInNjb3BlIjpbInNlbGYiLCJoZWxsb3dvcmxkIl0sImlhdCI6MTQ5MDg5ODk1NSwiZXhwIjoxNTIyNDM0OTU1fQ.O2k-senypXFZQwW4Ln3mBg60qzOSo-diPQWVfir3m6Q'."
}
This is the example of their official documentation, how it can be it doesnt works, or I didnt do something good?
I think that the error message is potentially misleading. If you are using the test example you need to request a clientid and token from WM per the documentation.
From the documentation:
With a valid access token and clientId, you are ready to make requests to Waste Management API.

How to fix "Bad Request","status":400"

I try to get twitch api with following website https://api.twitch.tv/kraken/streams/ chennal name ,but nothing happened and get error
{"error":"Bad Request","status":400,"message":"No client id specified"}
I expect to get viewers count and follower count
it's necessary to include your client ID with the request. For example:
curl -H 'Accept: application/vnd.twitchtv.v5+json' \
-H 'Client-ID: uo6dggojyb8d6soh92zknwmi5ej1q2' \
-X GET 'https://api.twitch.tv/kraken/streams/44322889'
See here for details on setting up your client ID.