arraysfacebookjsonfacebook-graph-apiphotos

Publishing photo to Facebook via Graph API: OAuthException: (#100) param tags must be an array


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.


Solution

  • 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}]