The SocialPublish API currently has just two easy calls:

  • publish: for publishing a message to the connected active social media accounts
  • hubs: for fetching a list of social media accounts connected to the SocialPublish account

The current 0.2 version of the API is still in beta.

Signing your requests

Every call to the API has to be signed with the access_token attached to your account. You can find your access_token on the dashboard page after you login to your SocialPublish account.

Publish

Use this API call if you want to publish your message to the social media accounts you connected with your SocialPublish account. It requires two variables: an access_token, and a body containing a JSON object with the information about the content you want to publish.

HTTP request method:POST
url:http://socialpublish.io/api/0.2/publish
variable:access_token, body

example of the content of a body variable

{
  "title"       : "Publish your blog to Twitter and Facebook!",
  "message"     : "You have to see the SocialPublish API!"
  "link"        : "http://socialpublish.io/api",
  "hashtag"     : "#socialpublishio, #winning",
  "hubs" : [
     "twitter:14678334",
     "facebook:509968792"
  ]
}

          

response on success

{
  "success" : true,
  "type" : "publish"
}

          

response on error

{
  "success" : false,
  "type" : "invalid_access_token",
  "message" : "The provided access_token is invalid."
}

          

Hubs

Use this API call if you want to fetch a list of social media accounts connected to your SocialPublish account. The call will only return the social media accounts you have enabled.

request method:GET
url:http://socialpublish.io/api/0.2/hubs
variable:access_token

response on success example

{
  "success" : true,
  "type" : "hubs",
  "hubs" : [
    { 
      "type" : "twitter", 
      "id" : "14678334", 
      "key" : "twitter:14678334",
      "name" : "jorgenhorstink" 
    },
    { 
      "type" : "facebook", 
      "id" : "509968792", 
      "key" : "facebook:509968792",
      "name" : "Jorgen Horstink"
    },
    { 
      "type" : "facebook page", 
      "id" : "299970546735855", 
      "key" : "facebook page:299970546735855",
      "name" : "socialpublish.io" 
    }
  ]
}

          

response on error

{
  "success" : false,
  "type" : "invalid_access_token",
  "message" : "The provided access_token is invalid.",
  "hubs" : []
}