How to upload a video in comments using Facebook Graph Api - facebook-graph-api

I've been trying this for so long, but i can't achieve it...
If i upload a video in /comment node it always spits me this error:
{"error":{"message":"(#200) Permissions error","type":"OAuthException","code":200,"fbtrace_id":"..."}}
If i'm going to upload images it just works fine.
This is my curl request so far..
curl -svX POST "https://graph.facebook.com/v15.0/{obj_id}/comments?access_token=EAA..." -F "message=Hello World!" -F "source=#./sample.mp4"

Related

Imitate the pause/resume behavior when downloading a file in postman

Is there a way to mimic the pause/resume behavior when downloading a file in postman like I do in chrome?
curl --location --request GET 'http://localhost:8080/api/dev/files/1
And I want to test if the download will work after a lost internet connection. When it recovers.

"error": "invalid_client" while using Django OAuth toolkit

I was following the steps mentioned in the documentation for django rest framework.
I'm not able to proceed from step 4.
As mentioned in the documentation,
curl -X POST -d "grant_type=password&username=<user_name>&password=<password>" -u"<client_id>:<client_secret>" http://localhost:8000/o/token/
I have changed the above variables with my values.
curl -X POST -d "grant_type=password&username=admin&password=admin123" -u "5hKeHNtF3EKy3uCpJqaAe3mU2bGZTgJhsKKxIuAQ:pbkdf2_sha256$390000$VFcCOjIZkBFObellddDgKA$DXovC1UiuxRQ0KN/lARIdQmXcj8dnoJofkznmkkqsZY=" http://localhost:8000/o/token/
I tried to import the curl on postman and Im getting this error
Then I tried running the curl on Insomnia testing tool, and I got the request configured as in the screenshot.
Then I click send and I got an error
SO i changed 'Content-Type' to 'Form URL Encoded'
Now I'm geting an error
{
"error": "invalid_client"
}
I tried running the curl in shell also, and I'm getting an invalid syntax error
I'm stuck with this and don't know how to proceed with this. Please lend me a hand.
Thanks in advance...
I was using the hashed value for client_secret instead of the actual value.
How to get actual client_secret actual value?
Answer:
While creating new application, copy the Client secret before saving
the values
https://github.com/jazzband/django-oauth-toolkit/issues/1193

facebook graph API send image message: "failed to fetch the file from the url"

Since 2018-02-22, I cannot send messages with images I uploaded to S3 to Facebook anymore.
I get the following error:
{"error":{"message":"(#100) Failed to fetch the file from the url","type":"OAuthException","code":100,"error_subcode":2018008,"fbtrace_id":"BP8L9CQBKP+"}}
Here is my test set-up:
TOKEN=<a_valid_page_token>
FBUSER=<an_fb_user_id>
URL=https://airy-layer-staging.s3.amazonaws.com/images/fd9aee26-7dd5-48cb-99c9-c4f10ec38f31.png
curl -H"Content-Type: application/json" https://graph.facebook.com/v2.6/me/messages?access_token=$TOKEN \
-d'{"recipient":{"id":"'$FBUSER'"},"message":{"attachment":{"type":"image","payload":{"url": "'$URL'"}}}}'
These URL all work fine
URL=http://rtens.org/images/avatar.jpg
URL=https://visualhunt.com/photos/s/4/anime-pet-kitty.jpg
URL=https://s3.amazonaws.com/codecademy-blog/assets/puppy-7_zps26e8a8d9.jpg
URL=https://smd-prod.s3.amazonaws.com/science-pink/s3fs-public/styles/front_page_hero_image/public/thumbnails/image/deer_duo.jpg
I've made sure that the images exist, are publicly available, and <2MB. The images are uploaded the same way as before 2018-02-22. Why does Facebook fail to fetch the file?
Thank you for your help,
Nikolas
I could solve the problem by disabling base64 encoding when uploading the image to S3.

How to upload image using raw in POSTMAN?

I am trying to upload an image using POSTMAN. I succeed with form-data but not with passing data in raw JSON format.
request through form-data in POSTMAN:
request through curl:
curl -X POST -H "Content-Type:multipart/form-data" -F "profile_image=#/home/shivani/Pictures/Wallpapers/8018.jpg" http://127.0.0.1:8000/api/users/1/image/
{"message":"Image Uploaded successfully.","profile_image":"http://res.cloudinary.com/aubergine-solutions/image/upload/v1430204993/w0oxhv6beaxd14twrxmi.jpg"}~
When I send request in raw as:
I get the following error though i have added MultiPartParser in Django settings:
Can anybody help to solve this problem?
When i'm using the image upload, i encoded the image using base64,and that encoded string is passed as json string.In the backend we can decoded the string and make the image.Try this, i think it works.

Using the Vimeo API, how do I replace all videos in a Vimeo album?

Using curl, I'm trying to create a working Vimeo API call that replaces the videos in a Vimeo album with a different set of videos. (The docs are here.) I am successfully deleting the existing videos from the album but my new video info seems to be invisible to Vimeo. Vimeo responds with a 201 ("created") instead of the 200 I'm looking for.
Here is my curl command (with subs for actual data):
curl -H "Authorization: bearer 123abc456def" -X PUT --data "videos=%2Fvideos%2F11111%2C%2Fvideos%2F22222%2C%2Fvideos%2F33333" "https://api.vimeo.com/me/albums/7777777/videos"
I don't know what I'm doing wrong and the Vimeo API docs & playground don't give me the answers I need. My questions and observations:
Should I be url encoding the new video URIs (e.g. 11111,22222, etc)? I have also tried without url encoding and it made no difference. But then the 201 might be telling me it didn't get as far as handling my replacement URIs.
a PUT is required for this operation. I have used PUT successfully to add a video to an existing album (in LiveCode, haven't tried it with curl)
I got the same results when I tried this PUT in LiveCode. I moved the request to curl because more people are familiar with curl.
This is my first rodeo using the Vimeo API. It's a great, vast resource and I've had no problems working with it until this. I'm just stuck on this item and really need it to work!
Thanks for any help you can offer.
This is an ancient, deprecated way of handling batch editing. I'm not sure how it still exists. We will move it to the proper batch creation standard in 3.4.
I think the existing system is supposed to be a comma separated list of video id's, so
curl -H "Authorization: bearer 123abc456def" -X PUT --data "videos=11111%2C22222%2C33333" "https://api.vimeo.com/me/albums/7777777/videos"
is likely the proper request.