E9.1 Upload JSON file with Connectors API

cheovargas

cheovargas

Member
Good afternoon

I want to upload a JSON file via Ochastrator, but it always gives me an error because it doesn't read the content of the file but interprets the file name with a JSON

Could someone help me see where I'm going wrong?

Thank you in advance for all the help you can give me
 
Hi @cheovargas

The JSON file, you can upload to JDE or an external system? Could you show your orchestrator?

Regards.
 
Good morning

Thank you for answering

I want to upload the JSON to an external system

I have not been able to upload the file, I don't know if I am missing a step or another connector
 

Attachments

  • ORCH.pdf
    183.7 KB · Views: 5
Hi Jose,

What do you map ${BodyJS} to coenctor999-03? The security is well? what is it the service response (http status and body response)? Did you try calling from postman?
 
Hola, José,

¿A qué asignas ${BodyJS} en coenctor999-03? ¿La seguridad está bien? ¿Cuál es la respuesta del servicio (estado http y respuesta del cuerpo)? ¿Intentaste llamar desde Postm

Hello Alfredo

Good afternoon Alfredo

In the $(BodyJS} I have been placing the content of the JSON file and so it uploads without problem, what I want is to upload the file instead of placing the body.

I validated it in Postman by uploading the file successfully

When I do it with the Orchestrator and try to upload the file, it tells me that it cannot find it.

Thank you very much in advance for your attention and collaboration
 
Ok, if you have the JSON file you would pass the file as File Input to orchestrator and to add the File to Connector.

Also, with a script (groovy or jruby) you could create a temporal file in the server and pass it to File Connector.
 
Ok, si tienes el archivo JSON, deberás pasar el archivo como entrada de archivo al orquestador y agregar el archivo al conector.

Además, con un script (groovy o jruby) podrías crear un archivo temporal en el servidor y pasarlo al Conector de Archivos.
Hola Alfredo

Eso es lo que quiero hacer, pero no lo he logrado subir.

Buscare mas informaicon acerpa de groovy o jruby, para ver si lo logro hacer.

Muchas gracias por su tiempo
 
Eso es, algo así:
Java:
import groovy.json.JsonSlurper

def jsonString = '{"nombre":"Juan", "edad":30, "ciudad":"Madrid"}'

try {
    def jsonObject = new JsonSlurper().parseText(jsonString)
    def filePath = "miArchivo.json"
    new File(filePath).write(jsonObject as String)
    println "Archivo JSON creado exitosamente: $filePath"
} catch (Exception e) {
    println "Error al crear el archivo: ${e.message}"
}

your json string would be your string as input, and filepath as input or harcoded with a path of the webserver accessible.

Then, in you connector select file upload, show File section when you map in file part name the rest parameter and in your source file name the file path (you could create a variable or hardcoded). as optional if you want remove file after service called.
1725624501247.png

This should works.

Saludos.
 
Back
Top