Jump to content

API image upload and insert?


Recommended Posts

I trying to figure out what would be the best way of using the rest api:

1. upload images to pages media when adding a database record

2. imbed this images within the content of the database record.

I can certainly do this manually using the 'Insert Image from URL' feature, but I don't see anything in the api documentation about doing this using the api.

Also I am not sure about embedding part. Would i just insert image url between the paragraphs and headings?

If it is not possible to use the api to upload the image then I could upload them to a subdomain. But how can I then insert the images into the content so the image tag is properly formatted?

At the moment they look like this

<img alt="9666-1.webp" class="ipsImage" data-loaded="true" data-ratio="58.50" data-src="https://content.invisioncic.com/e322713/pages_media/9666-1.webp" height="571" src="https://www.enotalone.com/applications/core/interface/js/spacer.png" style="height: auto;" width="1000">

So, will inserting simply img tag be automatically formatted to add the data-loaded, data-ratio, style etc? 

Thank you.

Edited by virap1
Link to comment
Share on other sites

There's unfortunately no endpoint to manage the pages media files via REST.

When a content is set via REST it depends on the authentication method  if \IPS\Text\Parser::parseStatic() is called or not, so it won't be replaced automatically. ( API KEY will set the content direct, while oAuth will call parseStatic with the users permissions)

You will probably need to format the content on your own before you're submitting it to the API endpoint.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...