I'm attempting to upload a photo to Facebook via the Graph API on a test user account for my app. With just the url, link, name
parameters present, the upload works fine returning a valid photo id.
However, if I use the additional tags
parameter, I end up with the following error returned:
{
"error": {
"message": "(#100) param tags must be an array.",
"type": "OAuthException",
"code": 100
}
}
I've tried to provide the value for tags
in almost every possible way I can think of, as I know the Graph API isn't straightforward (even the parameter url
which is used to upload a photo from a URL isn't listed under the photo
Graph API method);
A single user id
tags=100003919104407
Multiple CS'd user ids
tags=100003919104407,100003919104408,100003919104409
Array with ids not as integers
tags=[100003919104407, 100003919104404,100003919104405]
Array with ids as strings
tags=["100003919104407", "100003919104404","100003919104405"]
Array containing objects, as per the Facebook Graph API documentation
tags=[{"id":"100003919104407"},{"id":"100003919104404"},{"id":"100003919104405"}]
If someone could tell me the right format/another parameter through which to pass user ids in order to have them tagged in a photo, I'd be very grateful.
OAuthException: If you receive an OAuthException error, it means that Edgar doesn't have the correct permissions to access your Facebook accounts right now. The password may have been changed on Facebook or Facebook may have reset your security session.
Try this
It should be in this format
[{"to":"100003919104407","x":0,"y":0},
{"to":"100003919104408","x":10,"y":10},
{"to":"100003919104409","x":20,"y":20}]
or
[{"tag_uid":"100003919104407","x":0,"y":0},
{"tag_uid":"100003919104408","x":10,"y":10},
{"tag_uid":"100003919104409","x":20,"y":20}]
Where did you get your information from? Have you check the tags section?
Create
You can create a tag on the photo by issuing an HTTP POST request to the tags connection, PHOTO_ID/tags.
Note: This feature is intended to help users tag their friends in real photos. You should not use this feature to encourage users to tag their friends if their friends are not actually in that photo, or to tag friends in composite photos. If your app is found to be encouraging this behavior, your usage of this feature may be disabled.
You can specify which user to tag using two methods: in the URL path as PHOTO_ID/tags/USER_ID, or in a URL parameter as PHOTO_ID/tags?to=USER_ID. To add several tags at once, you can specify a tags property which contains an array of tags like so PHOTO_ID/tags?tags=[{"id":"1234"}, {"id":"12345"}]. Currently, you cannot tag a Page in a photo using this API.
There's also an example.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With