How to send image to collection (in JSON) with http-functions.js, using Base64?

Hi,

I’ve got a problem.
I send datas to my collections from iOS Shortcuts and Zapier (JSON with Webhooks).

No problem for text datas.
But for images, I only can send the URL.
Images are displayed in Wix, but I want to send the image file, to be hosted by Wix.

In iOS Shortcuts (my trigger), I can encode image in Base64.
How to decode it to be hosted by Wix please?

I am using the code below for now:

'use strict';
import {ok, response, serverError, badRequest} from 'wix-http-functions';
import wixData from 'wix-data';
export function post_addthings(request) { // POST = Method
return request.body.json()
    .then(body => {
 let recordInsert = {
 "title":  body.title,
 "description": body.description,
 "source": body.source,
 "image": body.image,
        };
 return wixData.insert('Database', recordInsert)
            .then(result => ok({body: JSON.stringify(result)}))
            .catch(err => response({status: 500, body: err}));
        }
    );
}

Thanks for your help :slight_smile:

Hi there …

You need to use upload( ) , the example in the link will help you.

Thanks @ahmadnasriya , I’ll check that :slight_smile:
But with Zapier I’m only able to use Webhooks (JSON format).
Will it work?