Support Topics Documentation Slack YouTube Blog

List of objects to upload images

I ran into a bit of a problem with uploading images using the rest API. I’m using appgyver for the front end, and the API is clearly working. The object ID is being generated, along with the creation date, and other data, but the file reference is not working. So I contacted appgyver support. There response:

I had a look and talked it over with some other team members, and the end result is that uploading the image as a file reference type into your database doesn’t work, and to make it work, you need to define images in your database to be an Object or List of Objects (this is annoying, I know). The properties you need to store are the storageKey and the download url of the file (other file fields can also be included). With these, you can always get a new, working url for the image.

Define images as a list of objects? How to do that using backendless?

Hello @l_r!

As I correctly understood your case, you can store image data in the JSON format. An object:

“{ “storageKey”: “imageStorageKey”, “downloadUrl”: “imageDownloadUrl” }”

or an array of objects:

“[ { “storageKey”: “imageStorageKey”, “downloadUrl”: “imageDownloadUrl” } ]”

Save and then get a required url from it.

This doc must be useful:

Regards, Igor

https://backendless.com/docs/rest/data_declaring_json_columns.md

I’m getting a 404 for this link. Do you have another link for declaring json columns? I created that column already, but the data is not posting. I wanted to review that page, to make sure I’m generating the columns correctly.

Hi @l_r,

I am getting that link fixed. The content on that page talks about creating a column in console and selecting JSON as the data type. There is no magic there.

How do you structure your request? I understand you’re using Appgyver and the problem may very well be there. Have you tried composing a REST request with something like Postman?

Regards,
Mark

Probably my error.

Column name “storage key”.
data type: JSON.

When I post using the rest console, I tried this:

{
“storage”: “imageStorageKey”,
“downloadUrl”: imageDownloadUrl"
}

The response is posted, but it generates its own column, as opposed to an object under storageKey (still null)

Oh, I see problem. It should be structured like this:

{
“storageKey”: {
“storage”: “imageStorageKey”,
“downloadUrl”: imageDownloadUrl"
},
}

Yeah, now its posting. Rookie mistake :slight_smile:

I am glad you figured it out!

1 Like

A tutorial on this (uploading files from appgyver to backendless) would greatly help. Been stuck on it for days. Appgyver and backendless together are amazing. More documentation will help both the platforms.

1 Like