Push API \ Upload a picture to a Facebook page 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/page/picture.json to upload a picture to a Facebook page. The <identity_token> is obtained whenever one of your users connects using his Facebook account.

To order to use this endpoint the permissions Manage Pages and Publish Pages must be enabled in the Facebook settings in your OneAll account and the user must have granted these permissions when he logged in with Facebook. You can use our Pull API to retrieve the pages of an identity.

POST data to include in the request

    {
     "request": {
       "push": {			
         "page": {
           "id": "#id#",
           "url": "#url#",
           "description": "#description#",      
           "create_post": #create_post# 
         }
       }
     }
    }
	
Key Description
* #id#
integer
The identifier of the page for which you want to upload the picture.
You can use our Pull API to retrieve the pages of an identity.
Example: 4563453
* #url#
string
The URL of the picture to upload. The allowed formats are jpeg, bmp, png, gif and tiff.
Example: https://www.facebook.com/images/fb_icon_325x325.png
#description#
string
The description of the picture to upload.
Example: http://www.oneall.com/
#create_post#
boolean, default true
If set to true, the picture is uploaded and displayed in a new post on the timeline of the page.
If set to false, the picture is uploaded but no post is being created. In this case you can use the returned picture_id to attach the picture to a new post.
Example: false

Result: the code returned by the API

Resultset Example

{
  "response": {
    "request": {
      "date": "Wed, 24 Apr 2019 10:42:49 +0200",
      "resource": "/push/identities/95681432-e02d-4a0b-ac6a-5c59d0e1fdfd/facebook/page/video.json",
      "status": {
        "flag": "success",
        "code": 200,
        "info": "Your request has been processed successfully"
      }
    },
    "result": {
      "data": {
        "provider": "facebook",
        "object": "picture",
        "page_id": "156657567747763",
        "page_location": "https://www.facebook.com/oneall.luxembourg/",
        "picture_id": "269915607225320",
        "picture_location": "https://www.facebook.com/269915607225320",
        "post_id": "156657567747763_2375176839229147",
        "post_location": "https://www.facebook.com/156657567747763_2375176839229147"
      }
    }
  }
}

User Contributed Notes