The /post API

Published 2 years ago by sai @ pretzelbox

This /post API returns the contents of a post as JSON. You can use this to design your pug templates or within a user facing html blog built using libraries and frameworks like React, VueJS, or Svelte. This blog itself is built using HTMX.

Here is the typical JSON structure of a PretzelBox blog postOther keys may be sent in the post JSON but they are to be ignored. 

URL<alphanumeric string of 7 character>

Getting Started

Note that the origin header field is needed with cURL. AJAX calls made from the browser automatically add the origin header.


    "attachments": [{
      "type": "attachment",
      "contentType": "image/jpeg",
      "partId": "2",
      "release": null,
      "contentDisposition": "inline" | "attachment", 
      "filename": "computer-ged0226db4_640.jpg",
      "contentId": "<ii_l17m67qr2>",
      "cid": "ii_l17m67qr2",
      "related": true,
      "headers": {}, 
      "checksum": "88a45c1ef8e0b8343c6fc075fc4aaeba",
      "size": 59597,
      "contentLocation": "blog/hofshrt/computer-ged0226db4_640.jpg",
      "wasInlined": true | false
  "post_excerpt": " excerpt in text..." || undefined,
  "html": "<p>email content in html<br>...<img src=\"\" alt=\"computer-ged0226db4_640.jpg\" width=\"562\" height=\"374\">...</p>",
  "text": "email content in text form",
  "subject": "Writing beautiful blog posts in Gmail",
  "date": "2022-03-26T08:53:14.000Z",
  "author": "Sanjiv Ranade" || undefined


  1. If an attachment's wasInlined flag is set to TRUE, it means that the html version of the blog post already includes a reference to the attachment (see below example)
  2. Attachments with the content disposition "attachment" are not inlined in html and can be shown as downloadable content on the blog post
Use post_excerpt to initialize HTML header tags for better SEO. This value may be missing from the JSON.

You can safely use the value of this key as the innerHTML of the div where they want to place their blog post's content. 

Use the value of this key in case you wish to use the raw, text form of the post. Images and other content are not inlined in text

This should be used as the title of the post 

The date the post was published 

The author of the post. This value may be missing from the JSON.