OwnYourGram

Importing from Instagram

OwnYourGram does not use the Instagram API, but instead will poll your account to find your photos. Because it has to poll, OwnYourGram has several polling tiers based on how often you post on Instagram.

If you have posted 7 or more photos in the last 14 days, you will be in the highest polling tier, so your account will be checked every 15 minutes. If you have posted 4-6 photos in the last 14 days, your account will be checked every hour. If you've posted 2-3 photos, your account will be checked every 6 hours, and if you've posted 0-1 photos then your account will be checked only every 24 hours.

Every time your account is checked, your polling tier is recalculated. This means if you suddenly post a bunch of photos, you'll start in the highest tier again.

If OwnYourGram encounters any Micropub errors when posting the photo to your site, your account is demoted by one tier.

Micropub

OwnYourGram will convert your Instagram photos and videos into a Micropub request, and send them to your Micropub endpoint.

Form-Encoded Request

The request to create a photo will be sent as multipart form-encoded with a file upload, so that the actual photo (and video) data is sent along with the request. Most web frameworks will automatically handle parsing the HTTP request and providing the POST parameters and the file upload automatically.

The request will contain the following POST parameters:

JSON Request

By default, OwnYourGram will send a multipart request to your Micropub endpoint with the photo (and video) as an upload. A better option is to handle the JSON format, since you'll get better information about venues, as well as person-tags.

If you have a Media Endpoint, then OwnYourGram will first upload the photo to your Media Endpoint and include the URL in the JSON request. If you don't have a Media Endpoint, then the Instagram URL will be included instead.

The JSON request will look like the below. The properties are the same as the form-encoded request with the exception of how location information is handled.

{
  "type": ["h-entry"],
  "properties": {
    "content": ["Photo caption from Instagram including #hashtags"],
    "published": ["2018-01-22T16:58:01-05:00"],
    "category": ["hashtags"],
    "location": [{
      "type": ["h-card"],
      "properties": {
        "name": ["Baltimore, Maryland"],
        "latitude": [39.2903],
        "longitude": [-76.6125]
      }
    }],
    "syndication": ["https://www.instagram.com/p/BeRIVrpAdcm/"],
    "photo": ["https://instagram.fsea1-1.fna.fbcdn.net/vp/afbe9ef713ea6a784b8b2d16cac075c7/5B0BB2B8/t51.2885-15/e35/26276701_146389926072712_1687561928420884480_n.jpg"]
  }
}

Note that every value is an array, even if there is only one value, which is the standard Microformats2 JSON format. See the Micropub specification for more details on the JSON syntax.

Authentication

The request will also contain an access token in the HTTP Authorization header:

Authorization: Bearer XXXXXXXX

Micropub Documentation

To learn more about setting up a Micropub endpoint, refer to the documentation and tutorials below.