Push API \ Upload a picture to Facebook PHP SDK

Resource/URI HTTP POST
Facebook · Publish a post on a user's profile /push/identities/<identity_token>/facebook/post.json Publish
User Post
Facebook · Upload a picture on behalf of a user /push/identities/<identity_token>/facebook/picture.json Upload
User Picture
Facebook · Upload a video on behalf of a user /push/identities/<identity_token>/facebook/video.json Upload
User Video
Facebook · Publish a post on a page the user administers /push/identities/<identity_token>/facebook/page/post.json Publish
Page Post
Facebook · Upload a picture on behalf of a page that the user administers /push/identities/<identity_token>/facebook/page/picture.json Upload
Page Video
Facebook · Upload a video on behalf of a page that the user administers /push/identities/<identity_token>/facebook/page/video.json Upload
Page Video
LinkedIn · Publish a post on a user's profile /push/identities/<identity_token>/linkedin/post.json Publish
User Post
LinkedIn · Publish a post on a company page the user administers /push/identities/<identity_token>/linkedin/company/post.json Publish
Company Post
Twitter · Publish a tweet on a user's timeline /push/identities/<identity_token>/twitter/post.json Publish
Tweet
Twitter · Upload a picture on behalf of a user /push/identities/<identity_token>/twitter/picture.json Upload
Picture
Twitter · Upload a video on behalf of a user /push/identities/<identity_token>/twitter/video.json Upload
Video
Pinterest · Publish a pin on behalf of a user /push/identities/<identity_token>/pinterest/pin.json Publish
Pin
YouTube · Publish a video on behalf of a user /push/identities/<identity_token>/youtube/video.json Upload
Video

Workflow

Request: the code to send to the API

Send a POST request with the data below to the endpoint /push/identities/<identity_token>/facebook/picture.json to upload a picture to the Facebook account of a user. The <identity_token> is obtained whenever one of your users connects using a social network account.

This endpoint is deprecated. On August 1, 2018 Facebook has removed the possibility for third-party apps to share to personal profiles. Alternatively you can use our API to upload pictures on pages.

POST data to include in the request

        {
          "request":{
            "push":{
              "picture":{
                "url": "#url#",
                "description": "#description#",
                "create_post": #create_post#
              }
            }
          }
        }
	
Key Description
* #url# The fully qualified URL of the picture to upload. The picture may not be larger than 5MB and must have one of the following formats: jpeg, bmp, png, gif, tiff.
Example: http://public.oneallcdn.com/img/oneall/logo_sni_retina.png
#description# A description of the picture.
Example: OneAll Logo
#create_post# Boolean flag, defaults to true.
If set to true, the picture is uploaded and displayed in a new post on the user's timeline.
If set to false, the picture is uploaded but no post is being created.
Example: false

Result: the code returned by the API

Resultset Example

{
  "response":{
    "request":{
      "date": "Thu, 21 Sep 2017 16:25:31  0200",
      "resource": "/push/identities/923843ec-1749-4cc1-988f-d6963f3b1baa/facebook/picture.json",
      "status":{
        "flag": "success",
        "code": 200,
        "info": "Your request has been processed successfully"
      }
    },
    "result":{
      "data":{
        "provider": "facebook",
        "object": "picture",
        "picture_id": "12345678901234567",
        "picture_location": "https://www.facebook.com/12345678901234567",
        "post_id": "1212121212_12345678901234567",
        "post_location": "https://www.facebook.com/1212121212_12345678901234567"
      }
    }
  }
}
	

User Contributed Notes