How can we import talend collection to postman? I found a way to import postman into talend but not the other way round. Is there any script or tool to do the migration?
Asked
Active
Viewed 974 times
3
-
1Any updates on this? Were you able to find anything ? – Neeraj Kumar Aug 30 '21 at 19:57
-
no, could not find a solve. – best wishes Aug 31 '21 at 01:54
-
no,i could not/ – best wishes Jul 21 '22 at 05:39
1 Answers
0
As the json exported from talend api tester cannot be directly imported into postman, you could write a converter to change its format so it can be accepted by postman's importer (I hope this will be supported officially in github as it's an open issue.).
An example converter in Python is here:
import json
# Open and read the Talend API Tester collection JSON file
with open('export_file.json', 'r') as f:
talend_data = json.load(f)["entities"]
# Create new Postman collection objects
for folder in talend_data:
folder_name = folder["entity"]["name"]
postman_collection = {
"info": {
"name": folder_name,
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
},
"item": [] # all subfolders
}
# Loop through the requests in the Talend collection and add them to the Postman collection
for subfolder in folder["children"]:
postman_subfolder = {
"name": subfolder["entity"]["name"],
"item": []
}
for request in subfolder["children"]:
request = request["entity"]
name = request["name"]
method = request["method"]["name"]
protocol = request["uri"]["scheme"]["name"]
uri = protocol + "://" + request["uri"]["host"] + request["uri"]["path"]
headers = []
for header in request["headers"]:
header_key = header["name"]
header_value = header["value"]
headers.append({
"key": header_key,
"value" : header_value,
"type": "text"
})
postman_request = {
"name": name,
"protocolProfileBehavior": {
"disableBodyPruning": "true"
},
"request": {
"method": method,
"header": headers,
"body": {
"mode": "formdata",
"formdata": []
},
"url": {
"raw": str(uri),
"protocol": protocol
}
},
"response": []
}
postman_subfolder["item"].append(postman_request)
postman_collection["item"].append(postman_subfolder)
# Write the Postman collection JSON to a file
with open(str(folder_name) + '.json', 'w') as f:
json.dump(postman_collection, f)

Zhaoyu Zhang
- 31
- 4