Integration of Trackline with Oracle ERP Cloud
Export documents and additional data from Trackline to Oracle ERP Cloud via API queries
Learn step-by-step how to integrate Trackline with Oracle ERP Cloud
Trackline is a functionality within the Code Contract platform that enables automation of data collection without altering workflows or requiring manual records.
If you want to integrate Trackline with Oracle ERP Cloud to retrieve documents and process data, follow these steps using JWT Token authentication.
Step 1: Obtain the authentication token
Oracle ERP Cloud must authenticate with the Trackline API by sending a POST request to obtain a JWT token. This token will be used in the following requests.
Request from Oracle ERP Cloud (HTTP Request)
POST /login HTTP/1.1
Host: api.codecontractplattform.com
Content-Type: application/json
{
"email": "oracle_integration_user",
"password": "oracle_secure_password"
}
Expected Response
HTTP/1.1 200 OK
Content-Type: application/json
{
"token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJmcmV..."
}
The token value must be stored in Oracle ERP Cloud and sent in each request as a Bearer Token in the authorization header.
Step 2: Query additional data and files in Trackline from Oracle ERP Cloud
Query additional data from a process
Oracle ERP Cloud can retrieve information about a specific process using the process_id or process_name.
Request from Oracle ERP Cloud
GET /track-line/ext/track-path/metadata?process_id=12345 HTTP/1.1
Host: api.codecontractplattform.com
Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJmcmV...
Expected Response
{
"process_id": "12345",
"name": "Oracle ERP Billing Process",
"status": "In Progress",
"created_at": "2024-02-09T10:30:00Z",
"documents": [
{
"doc_id": "98765",
"doc_name": "Invoice_001.pdf",
"doc_type": "Invoice"
}
]
}
Oracle ERP Cloud can use this information to manage processes and documents automatically.
Download an attached file
Once metadata is obtained, Oracle ERP Cloud can download an attachment using its attachment_id.
Request from Oracle ERP Cloud
GET /track-line/ext/attachment/file?attachment_id=98765 HTTP/1.1
Host: api.codecontractplattform.com
Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJmcmV...
Expected Response (File)
The server will respond with a file in PDF, XML, or the appropriate format, which Oracle ERP Cloud can store or process.
Integration in Oracle ERP Cloud (PL/SQL Example)
If you need to integrate this functionality into Oracle ERP Cloud using PL/SQL, you can use the following code:
DECLARE
v_url VARCHAR2(4000);
v_token VARCHAR2(4000);
v_response CLOB;
v_http_req UTL_HTTP.REQ;
v_http_resp UTL_HTTP.RESP;
v_buffer VARCHAR2(32767);
BEGIN
-- Step 1: Get JWT Token
v_url := 'https://api.codecontractplattform.com/api/login';
v_http_req := UTL_HTTP.BEGIN_REQUEST(v_url, 'POST', 'HTTP/1.1');
UTL_HTTP.SET_HEADER(v_http_req, 'Content-Type', 'application/json');
UTL_HTTP.WRITE_TEXT(v_http_req, '{"email": "oracle_integration_user", "password": "oracle_secure_password"}');
v_http_resp := UTL_HTTP.GET_RESPONSE(v_http_req);
LOOP
UTL_HTTP.READ_LINE(v_http_resp, v_buffer);
v_response := v_response || v_buffer;
END LOOP;
UTL_HTTP.END_RESPONSE(v_http_resp);
-- Extract Token (Basic Example)
v_token := 'extract_token_from_v_response';
-- Step 2: Query Process Metadata in Trackline
v_url := 'https://api.codecontractplattform.com/api/track-line/ext/track-path/metadata?process_id=12345';
v_http_req := UTL_HTTP.BEGIN_REQUEST(v_url, 'GET', 'HTTP/1.1');
UTL_HTTP.SET_HEADER(v_http_req, 'Authorization', 'Bearer ' || v_token);
v_http_resp := UTL_HTTP.GET_RESPONSE(v_http_req);
v_response := NULL;
LOOP
UTL_HTTP.READ_LINE(v_http_resp, v_buffer);
v_response := v_response || v_buffer;
END LOOP;
UTL_HTTP.END_RESPONSE(v_http_resp);
DBMS_OUTPUT.PUT_LINE('Response: ' || v_response);
END;
/
Summary
✔️ Step 1: Oracle ERP Cloud obtains the JWT Token via authentication.
✔️ Step 2: Oracle ERP Cloud queries process metadata using process_id.
✔️ Step 3: Oracle ERP Cloud downloads attachments using attachment_id.
✔️ Step 4: Oracle ERP Cloud can automate these processes using PL/SQL or an API connector.
If you need more information or support, contact the Code Contract team. 🚀
