I'm trying to exchange a fb API Graph token with a long-lived one according to the explanation given in this link
Here what I do
url = "https://graph.facebook.com/oauth/access_token?grant_type=fb_exchange_token&client_id={"+app_id+"}&client_secret={"+secret+"}&fb_exchange_token={"+old_token+"}"
resp = urllib.urlopen(url).read()
print resp
Here the result
{"error":{"message":"Invalid Client ID","type":"OAuthException","code":101,"fbtrace_id":"Bjvz2LDzJhs"}}
I'm using Python, I know that there is not an official SDK but I just need to crawl some post and save related data.
I don't understand what is happening, why does the client id should be not valid?
PS: the old_token works
thanks in advance!
Related
I'm not super familiar with APIs and have only worked with a few before where they have been quite simple to use (generate access token on website, use access token as header in get request to pull data).
I'm trying to pull data from an account on the Yahoo Japan Ads platform. Here is the documentation/tutorial I've been following: https://ads-developers.yahoo.co.jp/developercenter/en/startup-guide/api-call.html
I've tried a few different pieces of code, the link states the auth url at the top: https://biz-oauth.yahoo.co.jp/oauth
I'm not sure what parameters are required for authorisation but I've tried multiple. Here is a snippet of my code.
import requests
url = 'https://biz-oauth.yahoo.co.jp/oauth'
params = {'client_id' : '1234', 'redirect_uri' : 'oob'}
response = requests.get(url, params = params)
response.status_code
I'm unsure of what to put as the redirect uri as I plan to just pull a report from the platform, the application i have added in platform shows this in the configuration: oob
So i have used oob as the redirect uri. Using the code above, I'm getting a 404 error.
In the initial link where it shows an example, I have tried using that link instead: https://biz-oauth.yahoo.co.jp/oauth/v1/authorize?response_type=code, this also returns a 400 error.
Any help or suggestions on how to do the auth would be appreciated!
Thanks
I'm trying to fetch metadata from thoughtspot. I am able to call the url using browser and fetch the data. But here I'm trying to achieve it via python program. According to thougthspot documentation. I have to enable trusted authentication and pass my secret key & username to obtain a token which I can use in my program.
https://developers.thoughtspot.com/docs/?pageid=api-auth-session
my username : username#username.com
secret key : secret-key
Below is my code:(generated by postman)
import requests
url = "https://<ThoughtSpot-host>/callosum/v1/tspublic/v1/session/auth/token?auth_token=secret-key&access_level=FULL&username=username#username.com"
payload={}
headers = {}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
I'm getting Bad request error. Anyone here using thoughtspot over this issue. Appreciate your support very much.
Error I'm getting:
{"type":"Bad Request","description":"The server could not understand the request due to invalid syntax."}
I can fetch data by calling the api using a web-browser. Below url returns list of all meta-data objects. I want to achieve this using a python program (I have to authenticate first & call the below URL - Authentication step is not working for me when I tried to follow the documentation)
https://<ThoughtSpot-host>/callosum/v1/tspublic/v1/metadata/list
Did you try changing the url so that it includes the domain name?
Also post the error you are getting. And a screenshot of a working request would be great!
I have been recently reading about the Twitch API reference to figure out getting channel ids by username, but have no idea how to use it. https://api.twitch.tv/helix/users is the link where I was sending my params.
URL = "https://api.twitch.tv/helix/users"
channelName = {'OAuth': os.environ["Oauth"]}
r = requests.get(url=URL, params=channelName)
print(r.text)
Message:
{"error":"Unauthorized","status":401,"message":"OAuth token is missing"}
I provided the token so I don't know where I went wrong. Any ideas?
Through the API itself you would use the twitch login name with
GET https://api.twitch.tv/helix/users?login=<login name>&login=<login name>
With the return values you can acquire the ID.
You can find the query and response information at
https://dev.twitch.tv/docs/api/reference#get-users
Though the error you're seeing means you haven't generated or setup a token required to make these requests from the Twitch API. You need to make sure you're going through the setup process and utilizing the client-ID and Oath token to make your requests.
More information on how to get started: https://dev.twitch.tv/docs/api#step-1-setup
I am trying to get GIPHY Dashboard data like :
Total GIF/ stickers Upload
GIF views
When I download/Export the data , the endpoint is:
https://giphy.com/api/v2/users/aggregations/?start_dt=2013-02-01&end_dt=2020-07-08&content_type=gif,sticker
I need to get the same data via API . I also read documentation but not able to find.The documentation only has V1 api whereas above link / endpoint is V2
I am using Python.
Could anyone please help me :)
https://giphy.com/api/v2/users/aggregations/?start_dt=2013-02-01&end_dt=2020-07-08&content_type=gif,sticker&api_key={api_token}
Have you tried to reach this endpoint? Can you enter your api_token here and try it?
import requests
url = '...'
response = requests.get(url)
response.json()
Possible duplicate: FB Graph API: Posting as a page, to a different page
Problem Statement:
I was trying to publish a post, say, from ABC page to XYZ page and ended up with this error:
(#200) Posts where the actor is a page cannot also include a target_id other than EVENT or GROUP
Note: I've an access_token of user's page (in this case: ABC).
What I've tried so far:
I'm using facebook_sdk for python to initiate an API calls.
# access_token of page on behalf the post will be published
graph = facebook.GraphAPI(access_token)
response = graph.put_wall_post(
message=facebook_post_data,
profile_id=profile_id # on which post will be published
)
which is equivalent to
{app-id}/feed?access_token=access_token&message=Hello&method=post
manage_pages, publish_pages, publish_actions are already in the scopes to grant!
Question:
Is there no way to solve this issue? or Am I missing something?!?
Because it's possible to publish post to a page from another page using Facebook UI.
Hence, Graph API documentation doesn't contain any explicit info. about the same, If it's not possible!
Thanks for your time!