1. Help Centre
  2. 📜 Technical Documentation
  3. 🪛 App. Programming Interface (API)

API CORE - Posts

Consulting and creating posts through API

Consult post

How to consult publications?

With GET/Post

curl 'https://api.steeple.com/v1/posts' \

--header 'Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE2ODMyXXX2MTYsInN1YiI6ImYzNjU0ODgwLTM0YzAtNGQ4Yi04OWU4LWEzNGU2MTE1YTM3NSJ9.eOpVocgU1Pzapnj3iFc6RzqWi3V63_xnXEb_AwDF-dx'

With the answer:

{

    "data": [

        {

            "id": "a155e6ff-4e31-4649-a073-bee27438fd01",

            "title": "My first post!",

            "description": "Lorem ipsum pain be amet, consectetur adipiscing elit. Nunc convallis tellus pharetra felis elementum, porttitor semper nisi volutpat. For consequet convallis mi vel sometimes.",

            "published_at": 2023-04-17T12:48:33Z,

            "attachments": [

                {

                    "type": "IMAGE",

                    "data": {

                        "filename": "myimage.jpg",

                        "content_type": "image/jpeg",

                        "byte_size": 81336,

                        "url_expires_at": 2023-05-03T11:01:56.594Z,

                        "url": "https://d3gbtcv04mgd2y.cloudfront.net/wgnvbaa5srepdmnteyrqdfw18w0w?Expires=1683111716&Signature=MQIqQ73Q3sTAcEKjWGBoHDOp0kRK6~VU-szj43ydI5UNIMr6EgVQIwljjfEf2bFEUbCx0w6DkCUOzMgXJ~w-sqbPv8R6o0eaX6uy7aCYgDHKdTz5yCHzlNREPlDHRwDiHq7v-V60VQFE47rIsXr0KU9ThKtwGpWWZz86WF5IRFqhAsJ1VeZ6Go-c3bEcFH6k34MCRVYp8FaFitl8M5DyTufX3JmBZ98~pkQBpzZF10nt2M44YS~mJf~semdJMZJZgBqu7k1~F3w30wJJovxJhX0R298qbxPWJ7W2ioGMjojhfEM6JiTQGxXxyXWJa1Xxw5oDaK4WRht5q2s3tVTC~Q__&Key-Pair-Id=K2M4YRGXa6X9E2"

                    }

                }

            ]

        }

    ],

    "meta": {

        "pagination": {

            "total": 1,

            "page": 1,

            "per_page": 1

        }

    }

}

The API will return all publications from the organization for which the authentication token was generated (all communities combined). Publications are returned in reverse chronological order (most recent first).

The response is systematically composed of a data block containing the list of publications and a meta block showing the pagination.

For each block postdata :

key

Description

id

Post Steeple ID

title

Title of the publication (60 characters max.)

description

Description of the publication, can be enriched with html formatting with authorized tags:<p>, <text>, <strong>, <em>, <s>, <u>, <br>, <span>

published_at

Date of publication (cf. Timezone and time zone)

attachments

List of media associated with the publication

For each media in the block attachments : 

key

Description

type

Type Steeple of Media, amongIMAGE, VIDEO ou PDF.

data.filename

File name

data.content_type

File MIME Type

data.byte_size

File size in bytes

date.url_expires_at

Expiry date of the media access link (default lifespan: 1 hour)

url

Media Access URL

The blockmeta is composed of:

key

Description

pagination.total

total number of posts meeting the query criteria

pagination.page

current page of publications returned in the response

pagination.per_page

number of posts returned per page


Query Parameters Available

key

Description

page

navigate to past posts (default, page=1)

per_page

change the number of posts returned per page (default per_page=20)


Use cases

Retrieve the last 3 publications:

curl 'https://api.steeple.com/v1/posts?per_page=3' \

--header 'Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE2ODMyXXX2MTYsInN1YiI6ImYzNjU0ODgwLTM0YzAtNGQ4Yi04OWU4LWEzNGU2MTE1YTM3NSJ9.eOpVocgU1Pzapnj3iFc6RzqWi3V63_xnXEb_AwDF-dx'


Retrieve the penultimate publication:

curl 'https://api.steeple.com/v1/posts?page=2&per_page=1' \

--header 'Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE2ODMyXXX2MTYsInN1YiI6ImYzNjU0ODgwLTM0YzAtNGQ4Yi04OWU4LWEzNGU2MTE1YTM3NSJ9.eOpVocgU1Pzapnj3iFc6RzqWi3V63_xnXEb_AwDF-dx'

 

Retrieve publications from a specific list of communities : 

View the organization's communities

curl 'https://api.steeple.com/v1/communities' \

--header 'Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE2ODMyXXX2MTYsInN1YiI6ImYzNjU0ODgwLTM0YzAtNGQ4Yi04OWU4LWEzNGU2MTE1YTM3NSJ9.eOpVocgU1Pzapnj3iFc6RzqWi3V63_xnXEb_AwDF-dx'

Given response : 

{

    "data": [

        {

            "id": "3570x3dc-c994-4e02-83ax-89b9c52f79de",

            "name": "Commu #1"

        },

        {

            "id": "ax9360f-3ca5-4axe-9fe3-0020600be67f",

            "name": "Commu #2"

        },

        {

            "id": "bea39x22-c395-48x6-b804-b0c428346c08",

            "name": "Commu #3"

        }

    ],

    "meta": {

        "pagination": {

            "total": 3,

            "page": 1,

            "per_page": 20

        }

    }

}


Retrieve post from communities “Commu #2” & “Commu #3”

curl 'https://api.steeple.com/v1/posts?community_ids[]=ax9360f-3ca5-4axe-9fe3-0020600be67f&community_ids[]=bea39x22-c395-48x6-b804-b0c428346c08' \

--header 'Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE2ODMyXXX2MTYsInN1YiI6ImYzNjU0ODgwLTM0YzAtNGQ4Yi04OWU4LWEzNGU2MTE1YTM3NSJ9.eOpVocgU1Pzapnj3iFc6RzqWi3V63_xnXEb_AwDF-dx'


Create posts

What is a post?

A publication is a content intended to be shared on one or more communities of the organization. It is composed of at least a title, a publication and an author. It can be enriched with images, a video or a PDF file.

Example post:

steeple's post


What are the steps for creating a publication?

To create a publication from our APIs, it is necessary to prepare the media before creating the content. Once the media is prepared, it will be linked to the post when it is created. Our platforms impose particular treatments on us for the media given the wide variety of files that we can support.

Publications are necessarily associated with one or more categories to respect the organization of content in the communities.

Synthetic :

steps for creating a publication

Prepare media

Prepare a file transfer

Prepare to transfer a media file to Steeple with:/blob

Query :

curl 'https://api.steeple.com/v1/blobs?user_id=895ef75e-b7bf-4e18-a145-xxx4a2a24e41' \

--header 'Content-Type: application/json' \

--header 'Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE2ODMyXXX2MTYsInN1YiI6ImYzNjU0ODgwLTM0YzAtNGQ4Yi04OWU4LWEzNGU2MTE1YTM3NSJ9.eOpVocgU1Pzapnj3iFc6RzqWi3V63_xnXEb_AwDF-dx' \

--data '{    "blob": {

        "filename": "myImage.jpg",

        "content_type": "image/jpeg",

        "byte_size": 81336,

        "checksum": "RYcBA3S5mOalTGP2AdWG9Q=="

    }

}’

Description of the block blob : 

Key

Description

filename

file name.

content_file

MIME type of the file. Useful to know how the media will be stored and displayed in Steeple.

byte_size

File size, in bytes.

checksum

File integrity verification signature, ensures file integrity during transfer, storage and viewing. Base64-encoded MD5 fingerprint.

Note : How can I know the checksum of my file?

On PowerShell (Windows), with the following series of commands:

$myFile=’./monfichier.jpg’

$hashString = Get-FileHash $myFile -Algorithm MD5 | select -ExpandProperty Hash

$hashByteArray = [byte[]] ($hashString -replace '..', '0x$&,' -split ',' -ne '')

$ContentMD5 = [System.Convert]::ToBase64String($hashByteArray)

Echo $ContentMD5


Information : To find out which media are supported for publications, consult the dedicated chapter of the online help:Formats, weights, sizes and resolutions

Example answer:

{

    "signed_id": “xxxxcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBBa1lLIiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--c3f2cd63df7f7ae154d628af6b3d03bd237bxxxx”,

    "direct_upload": {

        "url_for_direct_upload": "<url>",

        "headers_for_direct_upload": {

            "Content-Type": "image/jpeg",

            "Content-MD5": "xxxxA3S5mOalTGP2AdWG9Q==",

            "Content-Disposition": "inline; filename=\"monImage.jpg\"; filename*=UTF-8''monImage.jpg"

        }

    }

}


Key

Description

signed_id

Technical identifier of the file to transfer

direct_upload.url_for_direct_upload

URL for transferring the file to the steeple storage space

direct_upload.headers_for_direct_upload

Parameters required for file transfer:

Content-Type : MIME type of file to transfer

Content-MD5 : Signature file to transfer

Content-Disposition : additional information on the file to be transferred

This action prepares the file transfer on the Steeple storage space. This then authorizes the deposit of the specific file.

Please note: the transfer URL provided is only valid for 5 minutes. After this time, it is necessary to prepare a new transfer.

Transfer file

Using the URL provided when creating the blob. It is necessary to position the correct HTTP headers to secure the upload.

Call example:

curl --request PUT '<url>' \

--header 'Content-MD5: xxxxA3S5mOalTGP2AdWG9Q==' \

--header 'Content-Disposition: inline; filename=\"monImage.jpg\"; filename*=UTF-8''monImage.jpg' \

--header 'Content-Type: image/jpeg' \

--data '@myImage.jpg'

The transferred file must respect the same name, the same size and the same content as the one declared previously in the blob.

The file hash is also checked during the transfer.

Create media

Associate the Blob and uploaded file with media that can be used in a post with:/upload

curl --request POST 'https://api.steeple.com/v1/uploads?content_type=image%2Fjpeg&signed_id=xxxxcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBBa1lLIiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--c3f2cd63df7f7ae154d628af6b3d03bd237bxxxx&user_id=895ef75e-b7bf-4e18-a145-xxx4a2a24e41' \

--header 'Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE2ODMyXXX2MTYsInN1YiI6ImYzNjU0ODgwLTM0YzAtNGQ4Yi04OWU4LWEzNGU2MTE1YTM3NSJ9.eOpVocgU1Pzapnj3iFc6RzqWi3V63_xnXEb_AwDF-dx'


Call settings

Key

Description

signed_id

Technical identifier of the transferred file

content_type

File MIME Type

user_id

User ID associated with media creation

The user must exist and belong to the organization to have the right to create the media.

Example answer:

{

    "type": "IMAGE",

    "id": “312b583a-cb37-47c9-ad38-xxx6ca5d5f23”,

    "filename": "myImage.jpg",

    "content_type": "image/jpeg",

    "url": "<url>"

}


With :

Key

Description

type

Calculated type of media amongIMAGE, VIDEO, PDF 

id

Technical identifier of the media created

filename

File name

content_type

File MIME Type

url

Media URL created to directly access the transferred file


Create a post

Create a post with/posts

curl 'https://api.steeple.com/v1/posts?user_id=895ef75e-b7bf-4e18-a145-xxx4a2a24e41' \

--header 'Content-Type: application/json' \

--header 'Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE2ODMyXXX2MTYsInN1YiI6ImYzNjU0ODgwLTM0YzAtNGQ4Yi04OWU4LWEzNGU2MTE1YTM3NSJ9.eOpVocgU1Pzapnj3iFc6RzqWi3V63_xnXEb_AwDF-dx' \

--data '{

  "title": "My first publication by API",

  "description": "Hello !",

  "group_ids": [

    “bd69a4fe-dde2-4d19-b1c6-xxx6627e8513”

  ],

  "attachments": [

    {

      "id": “312b583a-cb37-47c9-ad38-xxx6ca5d5f23”,

      "type": "IMAGE"

    }

  ]

}'


Call settings:

Key

Description

user_id

Identifier of the user who will be associated with the publication (author)

The user must exist and belong to the organization to have the right to create a post.

Request body:

Key

Description

title

Title of the publication (60 characters maximum)

description

Text

Formatting (line break, paragraph, emphasis, etc.) is applied exclusively with authorized HTML tags (*) : <p>, <text>, <strong>, <em>, <s>, <u>, <br>, <span>


(*): attributes are not allowed.

group_ids

List of category identifiers in which the publication will be visible

attachments

Media list

Information : Certain constraints are imposed on the use of media, in particular PDFs, in publications. For more information, consult the online help in the chapter:Formats, weights, sizes and resolutions

Example answer:

{

    "id": "b8fe7e49-8c72-4576-8a7a-b5b95a3e5000",

    "title": "My first publication by API",

    "description": "This is a post with an image.",

    "published_at": "2023-05-10T13:53:20Z",

    "attachments": [

        {

            "type": "IMAGE",

            "data": {

                "filename": "myImage.jpg",

                "content_type": "image/jpeg",

                "byte_size": 81336,

                "url_expires_at": "2023-05-10T14:53:21.050Z",

                "url": "https://d3gbtcv04mgd2y.cloudfront.net/a6s0pinn0khyc5xrpanjq5wiftdk?Expires=1683730401&Signature=OvELBhlkrPcIEgTG1qBcgUKlE~oEpVZFe9qXl1tohctHbxRX-askGui-ptjcXTIu4YMY6c-ZWmeQVAP3WvhHpJB1EH7~cuWcCxwk0GkajrhT4UesuDEyaAYjgZFu8Nm04DQeas4rZ63sqZdQAU-sAVopikgjxExwyeVZhiEsCeAh32s6iJzj8zI4HCsGbZK8VM4MX1lKF2zcVpLJjuHp-N92xej9-W~APJw0X0imX9fVcC2e9CPrX2ENnGfmS0WvJBG4RoPBFG3agQs~dH~ebAlueWVl2Ggb03DoYEobyR18VUxI5JfR1G45M60-p0GgYbZQ0IQp2LSQMzDoFG7jBg__&Key-Pair-Id=K2M4YRGXB6X9E2"

            }

        }

    ]

}


Key

Description

id

Post ID

title

Publication title

description

Description

attachments

List of media associated with the publication

And for each associated media in the block attachments: 

Key

Description

type

Media Steeple type, among IMAGE, VIDEO or PDF.

data.filename

File name

data.content_type

File MIME Type

data.byte_size

File size in bytes

data.url_expires_at

Expiry date of the media access URL (default lifetime: 1h)

data.url

Media Access URL


Use cases

Publication with only text (without media)

For this specific case, it is not necessary to prepare media beforehand. Step: creation of the publication:

curl 'https://api.steeple.com/v1/posts?user_id=895ef75e-b7bf-4e18-a145-xxx4a2a24e41' \

--header 'Content-Type: application/json' \

--header 'Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE2ODMyXXX2MTYsInN1YiI6ImYzNjU0ODgwLTM0YzAtNGQ4Yi04OWU4LWEzNGU2MTE1YTM3NSJ9.eOpVocgU1Pzapnj3iFc6RzqWi3V63_xnXEb_AwDF-dx' \

--data '{

  "title": "Post only with text",

  "description": "<strong>My post with text only !</strong><br/><br/><p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse a sodales massa. Curabitur justo ligula, porttitor a mauris eget, finibus aliquam purus. Mauris non est vel lacus tempor aliquet ut a lectus. Praesent sed malesuada elit. Vivamus ut efficitur sapien. Cras dui ex, tempus sed laoreet sed, elementum a ante. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. </p><br><p>Phasellus lobortis pharetra lacinia. Etiam vulputate odio malesuada quam pharetra, vel ornare magna egestas. Pellentesque urna neque, maximus in leo eu, elementum pulvinar lorem. Aliquam aliquet diam felis, eget malesuada felis pretium sit amet. Cras quis elit blandit, semper risus non, elementum libero. Etiam id nisi id purus pretium malesuada. Morbi facilisis aliquam dolor sed auctor. Praesent et purus sem. Phasellus congue sem massa, a fringilla erat consectetur eu.</p>",

  "group_ids": [

    “7fdbc2ec-2d9d-4b67-af07-xxx790a32d03”

  ]

}'

With the result:

post with lorem ipsum

Publish with an image and a PDF

3 steps are required:

  1. Image media preparation
  2. preparation of PDF media
  3. post creation

Step 1: Preparing the image

Preparing for the transfer:

curl 'https://api.steeple.com/v1/blobs?user_id=895ef75e-b7bf-4e18-a145-xxx4a2a24e41' \

--header 'Content-Type: application/json' \

--header 'Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE2ODMyXXX2MTYsInN1YiI6ImYzNjU0ODgwLTM0YzAtNGQ4Yi04OWU4LWEzNGU2MTE1YTM3NSJ9.eOpVocgU1Pzapnj3iFc6RzqWi3V63_xnXEb_AwDF-dx' \

--data '{    "blob": {

        "filename": "vacation.jpg",

        "content_type": "image/jpeg",

        "byte_size": 94249,

        "checksum": "ULcrRChXrcMvHbNNhrcb4g=="

    }

}

'

File transfer:

curl --request PUT '<url>' \

--header 'Content-MD5: ULcrRChXrcMvHbNNhrcb4g==' \

--header 'Content-Disposition: null' \

--header 'Content-Type: image/jpeg' \

--data '@holidays.jpg'

Media creation:

curl --request POST 'https://api.steeple.com/v1/uploads?content_type=image%2Fjpeg&signed_id=xxxxcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBBbmtLIiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--9ad0055ce0afc5476c4fe2b8e04194b6b5cbc53e&user_id=895ef75e-b7bf-4e18-a145-xxx4a2a24e41' \

--header 'Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE2ODMyXXX2MTYsInN1YiI6ImYzNjU0ODgwLTM0YzAtNGQ4Yi04OWU4LWEzNGU2MTE1YTM3NSJ9.eOpVocgU1Pzapnj3iFc6RzqWi3V63_xnXEb_AwDF-dx'


Step 2: Preparing the PDF

Preparing for the transfer:

curl 'https://api.steeple.com/v1/blobs?user_id=895ef75e-b7bf-4e18-a145-xxx4a2a24e41' \

--header 'Content-Type: application/json' \

--header 'Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE2ODMyXXX2MTYsInN1YiI6ImYzNjU0ODgwLTM0YzAtNGQ4Yi04OWU4LWEzNGU2MTE1YTM3NSJ9.eOpVocgU1Pzapnj3iFc6RzqWi3V63_xnXEb_AwDF-dx' \

--data '{    "blob": {

        "filename": "Notes - How to set leave.pdf",

        "content_type": "application/pdf",

        "byte_size": 13580,

        "checksum": "baihuOuGX0ItS0y2BUTSow=="

    }

}

'

File transfer:

curl --request PUT '<url>' \

--header 'Content-MD5: baihuOuGX0ItS0y2BUTSow==' \

--header 'Content-Disposition: null' \

--header 'Content-Type: application/pdf' \

--data '@/C:/Users/Nicolas/Downloads/Notes - How to set leave.pdf'

Media creation:

curl --request POST 'https://api.steeple.com/v1/uploads?content_type=application%2Fpdf&signed_id=xxxxcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBBbv9LIiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--47616524b684b72f3cdf18e5b859b49898f09bc4&user_id=895ef75e-b7bf-4e18-a145-xxx4a2a24e41' \

--header 'Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE2ODMyXXX2MTYsInN1YiI6ImYzNjU0ODgwLTM0YzAtNGQ4Yi04OWU4LWEzNGU2MTE1YTM3NSJ9.eOpVocgU1Pzapnj3iFc6RzqWi3V63_xnXEb_AwDF-dx'


Step 3: Creation of the publication:

curl 'https://api.steeple.com/v1/posts?user_id=895ef75e-b7bf-4e18-a145-xxx4a2a24e41' \

--header 'Content-Type: application/json' \

--header 'Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE2ODMyXXX2MTYsInN1YiI6ImYzNjU0ODgwLTM0YzAtNGQ4Yi04OWU4LWEzNGU2MTE1YTM3NSJ9.eOpVocgU1Pzapnj3iFc6RzqWi3V63_xnXEb_AwDF-dx' \

--data '{

  "title": "Publish with Image and PDF",

  "description": "<strong>Ma publication avec image et PDF !</strong><br/<<br/><p>Lorem ipsum dolor est amet, consectetur adipiscing elit. Suspendisse a membersa massa. Curabitur justo ligula, porttitor a mauris eget, the boundaries are pure. There is no mauris, nor is the lake time, as a bed. Praesent, but the male elite. We live as it becomes wise. The next day, but the time, but the element from before. The class is apt to be silent, and the partners are turning to the shores through our marriages, through </p>",

  "group_ids": [

    "7fdbc2ec-xxxx-4567-af07-a6079cz32d03"

  ],

  "attachments": [

    {

      "id": "dca46cc5-xxxx-4b6a-80cf-8142b5d78975",

      "type": "IMAGE"

    },

    {

      "id": "42306fc5-xxxx-4bc0-b05e-49df4bc4cb75",

      "type": "PDF"

    }

  ]

}'

With the result:

post with picture and pdf's document