For password encryption, I use Automic built in objects. I modified UC_LOGIN_TYPES in client 0 to have Internal type. (only custom login types can be for the below)
I created a new login object using Internal with a username password, named "LOGIN.CUSTOM". In this case the user is "RESTAPI/JDE" and password is password
:SET &USER# = GET_LOGIN(LOGIN.CUSTOM,serverxyz,INTERNAL,LOGIN_INFO)
:SET &PASS# = GET_LOGIN(LOGIN.CUSTOM,serverxyz,INTERNAL,PASSWORD)
&UC_JOBMD CMD="curl -D- --basic -u &USER#:&PASS# -X POST -H "Content-Type: application/json" http://serverxyz:8088/ae/api/v1/20/executions -d '{\"object_name\":\"DH.MAIN_WF\"}'"
You might need to do some work with the quotes due to the entire command being inside them.
Original Message:
Sent: Aug 20, 2024 06:03 AM
From: Klaus Lintz
Subject: Job execution via REST API using curl
Hi Team
The customer has a requirement to execute a workflow via the REST API using curl but it's not working.
The user do exist and listening on port 8088
Currently the password is not encoded - next step
Below is the code and output
curl -D- --basic -u RESTAPI/JDE:'password' -X POST -H "Content-Type: application/json" http://serverxyz:8088/ae/api/v1/20/executions -d "{\"object_name\":\"DH.MAIN_WF\"}"
OUTPUT:
HTTP/1.1 401 Unauthorized
Date: Tue, 20 Aug 2024 08:47:59 GMT
Content-Type: application/json
WWW-Authenticate: Basic realm="AUTOMIC"
Content-Length: 116
{
"code" : 45254,
"error" : "The credentials are not valid.",
"details" : "No detail information available."
Any help with be appreciated
Klaus