Adding photos to a CMS Collection

Hi All,

I am working with the CMS API and I am trying to add photos to a collection by using the API documentation and testing with Postman.

Some content on what I am trying to do:
I have a URL link that when clicked bring you to an image and I also have a title for the image. What I would like to be able to do if POST that image URL link and the image title to an Item inside a collection and they be able to have my site display the image on a page.

When reviewing the API docs under Items-> Create Collection Item I see that a field called type needs to be passed. Reviewing the Field Model I can see that it requires a FieldType and from that I can one called ExtFileRef which states “An object containing name (string) and URL (string) properties” which seems the best best to go with.

If I am to use the FieldType ExtFileRef, what custom field must be set inside the collection settings for that to work?

What would be the best approach at achieving the above using the CMS API?

I have attached a screenshot of me trying to use the ExtFileRef type but its failing due to validation, again I could be misinterpreting the documentation:

Thank you in advanced!

Cathal

Dropping a comment in hopes it bumps this. Anybody able to help me out? Thanks

Hi @butlawr, it looks like your fields object should look more like this example from the docs. You’d just need to edit the fields to match the fields in your collection and pass the image URL as the value for the image field.

fields: {
      name: 'Exciting blog post title',
      slug: 'exciting-post',
      _archived: false,
      _draft: false,
      color: '#a98080',
      author: '580e640c8c9a982ac9b8b778',
      'post-body': '<p>Blog post contents...</p>',
      'post-summary': 'Summary of exciting blog post',
      'main-image': '580e63fe8c9a982ac9b8b749'
    }

Thank you very much @blakelam,

It seems also the issue I was facing was that the image URL I am providing is not working on the Webflow CMS side although I get a status 200:

When I test it with a Webflow test image URL link it works:

Anyway time to figure that one out.

I believe the issue I am faced with is due to the Content-Type the server is responding with in the headers when I request the image via the URL. It is responding with “binary/octet-stream” when I believe it should be “image/jpeg”