🚀 Automating EDM Imports Using REST API
In today’s data-driven landscape, automation plays a key role in improving efficiency and reducing manual effort. In Enterprise Data Management (EDM), most actions can be automated using REST APIs—including one of the most common tasks: metadata imports.
In this blog, we’ll walk through how to automate the EDM import process step by step using REST APIs, along with practical examples using Python.
🔧 Tools Used
For testing and constructing API requests, I used Postman. It’s a great tool to:
- Build REST API calls
- Test endpoints
- Generate request structures before implementing them in code
To execute any REST API call in EDM, you need three key components:
- REST URL
- HTTP Action (GET/POST/PATCH, etc.)
- Request Body
📝 Step 1: Create a New EDM Request
The first step is to create a request in EDM where the import will be processed.
🔹 API Details
- REST URL
https://<instance>/epm/rest/v1/requests
- Action
POST
- Request Body (JSON)
{ "viewUri": "https://<instance>/epm/rest/v1/views/<view_id>", "title": "Automated Import Request", "description": "Request created using REST API", "notes": ""}
📌 The
view_idremains constant for a given import view.
🔹 Sample Python Code
import requestsimport jsonurl = "https://<instance>/epm/rest/v1/requests"payload = json.dumps({ "viewUri": "https://<instance>/epm/rest/v1/views/<view_id>", "title": "Automated Import Request", "description": "Request created using REST API", "notes": ""})headers = { 'Content-Type': 'application/json', 'Authorization': 'Basic <encoded_credentials>'}response = requests.post(url, headers=headers, data=payload)print(response.text)
🔹 API Response
The response will include a Request ID, which is critical for the next steps:
{ "id": "948ba2aa-xxxx-xxxx-xxxx-680e5b9dc5ab", "status": "DRAFT", "viewName": "Import Master"}
✅ Save this
id— it will be used to upload files and submit the request.
📂 Step 2: Upload Import File to EDM
Once the request is created, the next step is to upload the import file.
🔹 API Details
- REST URL
https://<instance>/epm/rest/v1/requests/{request_id}/attachments/importFile
- Action
POST
- Request Type
form-data
🔹 Sample Python Code
import requestsurl = "https://<instance>/epm/rest/v1/requests/{request_id}/attachments/importFile"files = [ ('file', ('SL_LOAD.xlsx', open('SL_LOAD.xlsx', 'rb'), 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'))]headers = { 'Authorization': 'Basic <encoded_credentials>'}response = requests.post(url, headers=headers, files=files)print(response.text)
🔹 API Response
{ "links": [ { "rel": "attachment", "href": ".../attachments/<attachment_id>" } ]}
✅ This confirms that the file has been successfully attached to the request.
🚀 Step 3: Submit the Request
After uploading the file, the final step is to submit the request for processing.
🔹 API Details
- REST URL
https://<instance>/epm/rest/v1/requests/{request_id}/transitions
- Action
POST
- Request Body
{ "action": "SUBMIT", "comment": "This request looks good to me.", "transitionWithWarning": false}
🔹 Sample Python Code
import requestsimport jsonurl = "https://<instance>/epm/rest/v1/requests/{request_id}/transitions"payload = json.dumps({ "action": "SUBMIT", "comment": "This request looks good to me.", "transitionWithWarning": False})headers = { 'Content-Type': 'application/json', 'Authorization': 'Basic <encoded_credentials>'}response = requests.post(url, headers=headers, data=payload)print(response.text)
🔹 API Response
{ "links": [ { "rel": "results", "href": ".../jobRuns/<job_id>" } ]}
🎯 This indicates that the request has been successfully submitted and is being processed.
✅ Final Outcome
At this point:
- The request is created
- The import file is uploaded
- The request is submitted for processing
You can now verify the request status directly in EDM.
💡 Key Takeaways
- EDM REST APIs enable end-to-end automation of import processes
- The workflow follows a clear sequence:
- Create Request
- Upload File
- Submit Request
- Python + REST APIs provide a powerful way to integrate EDM with external systems
🔚 Conclusion
Automating EDM imports using REST APIs significantly reduces manual intervention and improves consistency. Once implemented, this approach can be integrated with scheduling tools or orchestration platforms like OIC, enabling fully automated data pipelines.
If you’re working extensively with EDM, mastering REST APIs is a game-changer for scalability and efficiency.
Leave a comment