ℹ️ Location API data

Sending coordinates via Micropub.

When using the JSON version of the Micropub API, Micro.blog can store location data with a blog post, including venue name, URL, latitude, and longitude.

To just send coordinates, use the location property:

POST /micropub
Authorization: Bearer 123456789
Content-Type: application/json

{
    "type": [
        "h-entry"
    ],
    "properties": {
        "published": [
            "2019-10-27T14:51:32-05:00"
        ],
        "content": [
            "Texas Book Festival."
        ],
        "location": [
            {
                "type": [
                    "h-adr"
                ],
                "properties": {
                    "latitude": [
                        30.273892650534542
                    ],
                    "longitude": [
                        -97.74060666521329
                    ]
                }
            }
        ]
    }
}

If you are making a check-in post with venue information, use the checkinproperty:

POST /micropub
Authorization: Bearer 123456789
Content-Type: application/json

{
    "type": [
        "h-entry"
    ],
    "properties": {
        "published": [
            "2019-10-27T14:51:32-05:00"
        ],
        "content": [
            "Texas Book Festival."
        ],
        "checkin": [
            {
                "type": [
                    "h-card"
                ],
                "properties": {
                    "name": [
                        "Texas Capitol Grounds"
                    ],
                    "url": [
                        "https://foursquare.com/v/4d8a30f199c2a1cd53508bd7"
                    ],
                    "latitude": [
                        30.273892650534542
                    ],
                    "longitude": [
                        -97.74060666521329
                    ]
                }
            }
        ]
    }
}

This is a subset of the full Micropub requests that apps like OwnYourSwarmsend.

The default Micro.blog themes do not currently do anything with this information. You can create a custom theme to access the coordinates as custom parameters, like this:

{{ if .Params.location }}
  <img src="https://example-mapping-service.com/?center={{ .Params.location.latitude }},{{ .Params.location.longitude}}" />
{{ end }}

The 4 available parameters are location.name, location.url, location.latitude, and location.longitude. The venue name is automatically prepended to post content so that no theme changes are necessary.

Back to Micro.blog Help Table of Contents