Hitting an error on a simple Instagram Graph API request. I am trying to check the status on a video container before posting it.
If I skip this step, sleep for 30 seconds (to make sure the Facebook server has enough time to process the container) and go straight to posting, it works. So you know the container ID and user access token are both accurate.
But if I insert this status check step, the response 400, bad request, etc. The content of the response is "Sorry, this content isn't available right now"
Here is the link for the official documentation: https://developers.facebook.com/docs/instagram-api/reference/ig-container
And below is my code. Any ideas?
EDIT: figured it out. The documentation says the URL is for graph.instagram.com, but it's supposed to be graph.facebook.com. Documentation is wrong?
url = f"https://graph.instagram.com/{container_id_response.json()['id']}"
container_ready = False
while not container_ready:
time.sleep(3)
# Check status
params = {"fields": "status,id",
"access_token":credentials['FB_USER_ACCESS_TOKEN']}
response = status_response = requests.get(url, params=params)
if response.json()['status_code'] == "FINISHED":
container_ready = True