You can store the user's response inside a property.
A URL will be saved in the property, you can send that URL to your backend and fetch the actual file using that URL on your backend and save it.
You can send the URL using two ways:
1. API Block
2. Code Block
Here's a code block example in java
package com.altin.custom_code;
import com.amazonaws.services.lambda.runtime.Context;
import com.amazonaws.services.lambda.runtime.RequestHandler;
import java.util.Map;
import java.util.Objects;
import javax.ws.rs.client.Client;
import javax.ws.rs.client.ClientBuilder;
import javax.ws.rs.client.Invocation;
import javax.ws.rs.client.WebTarget;
import morph.base.beans.CustomCodeResponse;
import org.glassfish.jersey.client.ClientConfig;
import org.glassfish.jersey.client.ClientProperties;
import org.glassfish.jersey.jackson.JacksonFeature;
// Please donot change the class name 'MorphCustomCode'
public class MorphCustomCode implements RequestHandler<Map<String, Object>, CustomCodeResponse> {
final static Client HTTP_CLIENT = ClientBuilder.newBuilder()
.withConfig(new ClientConfig()
.property(ClientProperties.SUPPRESS_HTTP_COMPLIANCE_VALIDATION,
true))
.register(JacksonFeature.class).build();
@Override
public CustomCodeResponse handleRequest(Map<String, Object> input, Context context) {
CustomCodeResponse customCodeResponse = new CustomCodeResponse();
// Write your code here. Please refer to the docs to learn more - https://morphdesk.freshdesk.com/en/support/solutions/articles/60000664433
// Access Rest API block response
Map<String, Object> userVariables = (Map<String, Object>) input.get("userVariables");
Object prop = String.valueOf(userVariables.get("image_or_document_property"));
if (Objects.nonNull(prop)) {
String url = String.valueOf(prop);
// Can save this url to their backend using api call
WebTarget target = HTTP_CLIENT.target("{{THEIR_BACKEND_URL}}");
Invocation.Builder builder = target.request();
//Response response = builder.post(null);
}
return customCodeResponse;
}
}