Uploading & Attaching Images

This guide describes how to upload images using the Ow.ly API

Step 1: Create a Twitter Developer Account

If you do not already have a Twitter developer account, you can create one here.

*Note that this Twitter account does not need to be added to Hootsuite.

Step 2: Create a Twitter App

Once you have setup your Twitter Developer Account, you'll need to create an app. For the Website field, you can temporarily set a valid http format placeholder URL.

Once an Application has been created, you'll need to generate an access token. Click the Keys and Access Tokens tab to obtain your keys.

Once you have your Twitter Consumer Key and Secret, and Access Token and Secret, you'll be able to make calls to Ow.ly with the appropriate authorization headers. Continue on to the Ow.ly API Reference for further steps on use of this API, or see below for steps on testing the Ow.ly API through Postman.

Step 3: Uploading an Image through Postman

First, you'll need to add the POST /photo/upload collection to Postman (Import > Paste raw text):

{  
   "variables":[  

   ],
   "info":{  
      "name":"Ow.ly Image Upload",
      "_postman_id":"08dae834-49bd-a5fd-9f65-a4f865fb4db0",
      "description":"",
      "schema":"https://schema.getpostman.com/json/collection/v2.0.0/collection.json"
   },
   "item":[  
      {  
         "name":"Ow.ly Image Upload",
         "description":"",
         "item":[  
            {  
               "name":"Upload a photo",
               "request":{  
                  "url":{  
                     "raw":"http://ow.ly/api/1.1/photo/upload?oauth_consumer_key=hBx0SYT5Q5LTIOMeB9orFlCm7&oauth_token=468775057-3YTg6BSFnBnzKkdF2iFhmfeI2IzUYesi4R9XRKHc&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1484271712&oauth_nonce=HxrvTEai2kr&oauth_version=1.0&oauth_signature=6OUkEXl1NA5n45avepoTC0Z+NL0=",
                     "protocol":"http",
                     "host":[  
                        "ow",
                        "ly"
                     ],
                     "path":[  
                        "api",
                        "1.1",
                        "photo",
                        "upload"
                     ],
                     "query":[  
                        {  
                           "key":"oauth_consumer_key",
                           "value":"hBx0SYT5Q5LTIOMeB9orFlCm7"
                        },
                        {  
                           "key":"oauth_token",
                           "value":"468775057-3YTg6BSFnBnzKkdF2iFhmfeI2IzUYesi4R9XRKHc"
                        },
                        {  
                           "key":"oauth_signature_method",
                           "value":"HMAC-SHA1"
                        },
                        {  
                           "key":"oauth_timestamp",
                           "value":"1484271712"
                        },
                        {  
                           "key":"oauth_nonce",
                           "value":"HxrvTEai2kr"
                        },
                        {  
                           "key":"oauth_version",
                           "value":"1.0"
                        },
                        {  
                           "key":"oauth_signature",
                           "value":"6OUkEXl1NA5n45avepoTC0Z+NL0"
                        }
                     ],
                     "variable":[  

                     ]
                  },
                  "method":"POST",
                  "header":[  
                     {  
                        "key":"Authorization",
                        "value":"OAuth ...",
                        "description":""
                     }
                  ],
                  "body":{  
                     "mode":"formdata",
                     "formdata":[  
                        {  
                           "key":"apiKey",
                           "value":"{{owlyApiKey}}",
                           "type":"text"
                        },
                        {  
                           "key":"fileName",
                           "value":"yoda.jpg",
                           "type":"text"
                        },
                        {  
                           "key":"uploaded_file",
                           "type":"file",
                           "src":"yoda.jpg",
                           "value":""
                        }
                     ]
                  },
                  "description":""
               },
               "response":[  

               ]
            }
         ]
      }
   ]
}

Under "Authorization", enter your Consumer Key, Consumer Secret, Token, and Token Secret, which you created above. Click "Update Request" to generate your Timestamp and Nonce. For more information on generating the required fields, see "Collecting Parameters" here.

Under "Body", ensure that form-data is selected. Enter your Ow.ly API Key for the apiKey field, choose a fileName, and upload a file.

Click "Send" to retrieve your Ow.ly image upload URL to include in your REST API calls.