Get Post Media
This is for getting any media attached to a post. It requires the post ID, and returns an array containing arrays of the URL path and name for each attached image.
The endpoint is "get/media/{postID}
". Here's an example:
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// this is any valid post ID | |
let postID = <num> | |
fetch(`${baseURL}api/get/media/${postID}`) | |
.then((blob) => { return blob.json() }) | |
.then((data) => { | |
// this will print the full path to each image returned | |
data.content.forEach((img) => { | |
console.log(`${img.path}${img.name}) | |
}) | |
}) |