Contentful logo

Contentful Community

Upload image and connect to an entry efficiently. Also how can I know the version to publish asset?

I am using Node core packages. Not contentful-management module. I am using a lambda and cannot use any other node modules.

My current method involves many API endpoints:

  1. Upload image with node buffer using application/octet-stream
  2. Convert uploaded image to asset
  3. Process Asset (with a version number, will this ever change?)
  4. Publish Asset (with a version number that I believe changes)
  5. Post entry using AssetId

That is 5 api calls! Is this necessary?
Can I just straight upload a entry json with an image binary?

Also, it seemed that the version changes. How am I suppsed to know what version number? Make another API call?