Having trouble using Multipart/form-data for API

I'm currently facing extreme difficulties trying to upload an image to a REST api. 

Using Multi-form/data component from the forge i'm facing an issue here.

In my server action calling the API:-
1. If i pass in below i will get error where input field not found

SyntaxEditor Code Snippet

ContentTypeGet(MultipartFormDataCreate.ContentType)

2. if i pass in below instead i will get input string error

SyntaxEditor Code Snippet

MultipartFormDataCreate.ContentType

Is there something that i have done wrong using this component?
it's 2020 and i really hope outsystems will just have build in support for multiform already =(

Hi Lim Xinyao,

You can refer to the article by Kilian, I have used the same in one of my application:

https://www.outsystems.com/blog/posts/consuming-multipart-form-data-rest-method/

Perhaps you are uploading Image, so it's would be easy to convert the Image into base64 & then use the normal API. And on receiver side just revert it back & save. I used this approach in another application where I have a need for uploading the Image.

Hope it helps,

Assif

Hi Lim,

Let us know whether you manage to fix it using the article. The original article can be found here, btw. Also, in general, when you have questions about a specific Forge component, it's best to post in the component's subforum, so that the component developers (in this case, me) are notified when a question arrives.