Multiple Photos upload on Facebook - facebook-graph-api

Is there any way to upload multiple photos together on facebook...
I have uploaded a single photo at a time using GraphAPI....but not multiple...
Please suggest...
Thanks...

You need to place a "batched" request to the Graph API. This is documented here: https://developers.facebook.com/docs/reference/api/batch/ (check out the paragraph "Uploading binary data"). Basically it's a cURL call where you json encode an array containing all the "batched" requests ("batch=[json array of calls]"). For some good reson Facebook limits your array to 20 requests. It translates pretty nicely to the PHP cURL methods, if you've got cURL enabled on your server...
curl
–F 'access_token=…' \
-F 'batch=[{"method":"POST", \
"relative_url":"me/photos", \
"body":"message=My cat photo" \
"attached_files":"file1" \
},
{"method":"POST", \
"relative_url":"me/photos", \
"body":"message=My dog photo" \
"attached_files":"file2" \
},
]’
-F 'file1=#cat.gif' \
-F 'file2=#dog.jpg' \
https://graph.facebook.com
UPDATE: replaced “ with " and ‘ with '

Related

Receiving Invalid Grant Type Error Received From AWS Cognito When Supply Auth Code : How do I get Id and access tokens for testing?

I am unable to successfully acquire an id token/access token from my AWS cognito user pool when I supply an auth code. I have written a shell script (see below), and receive invalid_grant back from the server.
I have encoded the base64 Authorization Basic header for client_id:client_secret generated with python as:
import base64
encode='my_client_id_string:my_client_secret_string'
base64.b64encode(encode)
#!/usr/bin/env sh
curl --location --request POST 'https://<domain>.auth.us-east-2.amazoncognito.com/oauth2/token' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Authorization: Basic <base64 encode string client_id:client_secret>' \
--data-urlencode 'grant_type=authorization_code' \
--data-urlencode 'client_id=<client_id from app settings' \
--data-urlencode 'code=<code received from redirect url to my localhost app endpoint>' \
--data-urlencode 'redirect_uri=http://localhost:8000/my_redirect'
Any ideas?
Solved it!
The problem was caused by an invalid client id. I had supplied a typo for the client id value!

How to convert curl command to postman(PayPal disputes API)

I encountered a problem while developing here
This curl command is something I have n’t encountered before and it has n’t been resolved for a long time
Please help me
How to convert to postman format, my import using postman cannot be recognized correctly
code:
curl -v -X POST https://api.sandbox.paypal.com/v1/customer/disputes/PP-D-27803/provide-evidence \
-H "Content-Type: multipart/related; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW" \
-H "Authorization: Bearer Access-Token" \
-F 'input={
"evidences": [
{
"evidence_type": "PROOF_OF_FULFILLMENT",
"evidence_info": {
"tracking_info": [
{
"carrier_name": "FEDEX",
"tracking_number": "122533485"
}
]
},
"notes": "Test"
}
]
};type=application/json' \
-F 'file1=#NewDoc.pdf'
我自己解决了
看图片
目前只能使用curl成功 postman python requests php 都没有成功
主要还是后面这个#符号
enter image description here

Trained a text-classification model and want to pass a .csv file with text items to predict

I have already trained my data set in Google auto ml. Now I want to pass a CSV with text items to predict its labels. Not sure on how to proceed
Have passed 17k text items with labels.
Have seen rest API & python codes to execute.
export GOOGLE_APPLICATION_CREDENTIALS=key-file-path
curl -X POST \ -H "Authorization: Bearer $(gcloud auth application-default print-access-token)" \ -H "Content-Type: application/json" \ https://automl.googleapis.com/v1beta1/projects/ticket-classification-poc/locations/us-central1/models/TCN8669499774734365168:predict \ -d '{ "payload" : { "textSnippet": { "content": "YOUR TEXT HERE", "mime_type": "text/plain" }, } }' Output : Need to pass future text items in bulk for prediction
You need to have a loop to go through all the CSV items programatically and send one by one.

What is the URL for access Ad Set Delivery Estimate endpoint?

I know that Ad Account Reachestimate was deprecated, but now available new endpoint Ad Set Delivery Estimate. I can't find any URLs in the documentation for this endpoint. Can you specify the URL to access this endpoint, please?
Have you tried this: https://developers.facebook.com/docs/marketing-api/reference/ad-account/delivery_estimate/
Curl example:
curl -G \
--data-urlencode 'targeting_spec={
"geo_locations": {"country_groups":["worldwide"]},
"user_device": ["Galaxy S6","One m9"],
"user_os": ["android"]
}' \
-d 'optimization_goal=IMPRESSIONS' \
-d 'access_token=<ACCESS_TOKEN>' \
https://graph.facebook.com/v2.10/act_<AD_ACCOUNT_ID>/delivery_estimate

Curl Error when trying to POST to AWS endpoint

I got
error: {"error":"Unexpected token ‘"}
with the curl command below.
What gives?
curl -X POST \
-H "X-Parse-Application-Id:SomeID" \
-H "Content-Type: application/json" \
-d ‘{“number”:"3016524500"}’ \
http://somedomain.com/parse/functions/testFunction
Please suggest.
I think the issue is that you're using different characters than the actual ' and " characters. Try replacing ” with " and ‘ with '.