import requests
url = "https://{FUSION HOST}/api/objects/import"
payload = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"contentDisposition\"\r\n\r\n{\r\n \"type\": \"<string>\",\r\n \"parameters\": {},\r\n \"fileName\": \"<string>\",\r\n \"creationDate\": \"2023-11-07T05:31:56Z\",\r\n \"modificationDate\": \"2023-11-07T05:31:56Z\",\r\n \"readDate\": \"2023-11-07T05:31:56Z\",\r\n \"size\": 123\r\n}\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"entity\"\r\n\r\n{}\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"headers\"\r\n\r\n{}\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"mediaType\"\r\n\r\n{\r\n \"type\": \"<string>\",\r\n \"subtype\": \"<string>\",\r\n \"parameters\": {},\r\n \"wildcardType\": true,\r\n \"wildcardSubtype\": true\r\n}\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"messageBodyWorkers\"\r\n\r\n{}\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"parent\"\r\n\r\n{\r\n \"contentDisposition\": {\r\n \"type\": \"<string>\",\r\n \"parameters\": {},\r\n \"fileName\": \"<string>\",\r\n \"creationDate\": \"2023-11-07T05:31:56Z\",\r\n \"modificationDate\": \"2023-11-07T05:31:56Z\",\r\n \"readDate\": \"2023-11-07T05:31:56Z\",\r\n \"size\": 123\r\n },\r\n \"entity\": {},\r\n \"headers\": {},\r\n \"mediaType\": {\r\n \"type\": \"<string>\",\r\n \"subtype\": \"<string>\",\r\n \"parameters\": {},\r\n \"wildcardType\": true,\r\n \"wildcardSubtype\": true\r\n },\r\n \"messageBodyWorkers\": {},\r\n \"parent\": \"<unknown>\",\r\n \"providers\": {},\r\n \"bodyParts\": [\r\n {\r\n \"contentDisposition\": {\r\n \"type\": \"<string>\",\r\n \"parameters\": {},\r\n \"fileName\": \"<string>\",\r\n \"creationDate\": \"2023-11-07T05:31:56Z\",\r\n \"modificationDate\": \"2023-11-07T05:31:56Z\",\r\n \"readDate\": \"2023-11-07T05:31:56Z\",\r\n \"size\": 123\r\n },\r\n \"entity\": {},\r\n \"headers\": {},\r\n \"mediaType\": {\r\n \"type\": \"<string>\",\r\n \"subtype\": \"<string>\",\r\n \"parameters\": {},\r\n \"wildcardType\": true,\r\n \"wildcardSubtype\": true\r\n },\r\n \"messageBodyWorkers\": {},\r\n \"parent\": \"<unknown>\",\r\n \"providers\": {},\r\n \"parameterizedHeaders\": {}\r\n }\r\n ],\r\n \"parameterizedHeaders\": {}\r\n}\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"providers\"\r\n\r\n{}\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"bodyParts\"\r\n\r\n{\r\n \"contentDisposition\": {\r\n \"type\": \"<string>\",\r\n \"parameters\": {},\r\n \"fileName\": \"<string>\",\r\n \"creationDate\": \"2023-11-07T05:31:56Z\",\r\n \"modificationDate\": \"2023-11-07T05:31:56Z\",\r\n \"readDate\": \"2023-11-07T05:31:56Z\",\r\n \"size\": 123\r\n },\r\n \"entity\": {},\r\n \"headers\": {},\r\n \"mediaType\": {\r\n \"type\": \"<string>\",\r\n \"subtype\": \"<string>\",\r\n \"parameters\": {},\r\n \"wildcardType\": true,\r\n \"wildcardSubtype\": true\r\n },\r\n \"messageBodyWorkers\": {},\r\n \"parent\": \"<unknown>\",\r\n \"providers\": {},\r\n \"parameterizedHeaders\": {}\r\n}\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"fields\"\r\n\r\n{}\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"parameterizedHeaders\"\r\n\r\n{}\r\n-----011000010111000001101001--"
headers = {"Content-Type": "multipart/form-data; boundary=---011000010111000001101001"}
response = requests.post(url, data=payload, headers=headers)
print(response.text){
"conflicts": [
"<string>"
],
"variablesWarnings": [
"<string>"
],
"variablesErrors": [
"<string>"
],
"variablesSubstitutions": [
"<string>"
],
"validationWarnings": [
"<string>"
],
"validationErrors": [
"<string>"
],
"importErrors": [
"<string>"
],
"importActions": [
"<string>"
],
"zipFileToken": "<string>",
"transformationMsgs": [
"<string>"
],
"status": "<string>"
}Import one or more objects. Validation is performed before import. Import starts only if validation succeeds. However, validation does not stop on the first error, so the complete list of errors is reported if there are any. You can also use the /objects/validate endpoint to validate an object without importing it.
Validation includes checking whether an object already exists on the target system and whether the user is authorized to create or modify the object.
For collection objects, the following special validation is performed:
- We check the searchClusterId of each collection and verify that a cluster with this ID exists on the target system or in the import file (error).
- We check that features, index profiles, and query profiles belong only to the collections specified in the import file (error).
- We check that a feature exists on the target system for each feature in the import file (error).
- We check for index profiles or query profiles that do not exist on the target system or in the import file (warning).
You can also substitute the password variables in your imported file using a separate file containing plaintext passwords, like this: -F 'variableValues=@password_file.json'
import requests
url = "https://{FUSION HOST}/api/objects/import"
payload = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"contentDisposition\"\r\n\r\n{\r\n \"type\": \"<string>\",\r\n \"parameters\": {},\r\n \"fileName\": \"<string>\",\r\n \"creationDate\": \"2023-11-07T05:31:56Z\",\r\n \"modificationDate\": \"2023-11-07T05:31:56Z\",\r\n \"readDate\": \"2023-11-07T05:31:56Z\",\r\n \"size\": 123\r\n}\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"entity\"\r\n\r\n{}\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"headers\"\r\n\r\n{}\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"mediaType\"\r\n\r\n{\r\n \"type\": \"<string>\",\r\n \"subtype\": \"<string>\",\r\n \"parameters\": {},\r\n \"wildcardType\": true,\r\n \"wildcardSubtype\": true\r\n}\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"messageBodyWorkers\"\r\n\r\n{}\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"parent\"\r\n\r\n{\r\n \"contentDisposition\": {\r\n \"type\": \"<string>\",\r\n \"parameters\": {},\r\n \"fileName\": \"<string>\",\r\n \"creationDate\": \"2023-11-07T05:31:56Z\",\r\n \"modificationDate\": \"2023-11-07T05:31:56Z\",\r\n \"readDate\": \"2023-11-07T05:31:56Z\",\r\n \"size\": 123\r\n },\r\n \"entity\": {},\r\n \"headers\": {},\r\n \"mediaType\": {\r\n \"type\": \"<string>\",\r\n \"subtype\": \"<string>\",\r\n \"parameters\": {},\r\n \"wildcardType\": true,\r\n \"wildcardSubtype\": true\r\n },\r\n \"messageBodyWorkers\": {},\r\n \"parent\": \"<unknown>\",\r\n \"providers\": {},\r\n \"bodyParts\": [\r\n {\r\n \"contentDisposition\": {\r\n \"type\": \"<string>\",\r\n \"parameters\": {},\r\n \"fileName\": \"<string>\",\r\n \"creationDate\": \"2023-11-07T05:31:56Z\",\r\n \"modificationDate\": \"2023-11-07T05:31:56Z\",\r\n \"readDate\": \"2023-11-07T05:31:56Z\",\r\n \"size\": 123\r\n },\r\n \"entity\": {},\r\n \"headers\": {},\r\n \"mediaType\": {\r\n \"type\": \"<string>\",\r\n \"subtype\": \"<string>\",\r\n \"parameters\": {},\r\n \"wildcardType\": true,\r\n \"wildcardSubtype\": true\r\n },\r\n \"messageBodyWorkers\": {},\r\n \"parent\": \"<unknown>\",\r\n \"providers\": {},\r\n \"parameterizedHeaders\": {}\r\n }\r\n ],\r\n \"parameterizedHeaders\": {}\r\n}\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"providers\"\r\n\r\n{}\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"bodyParts\"\r\n\r\n{\r\n \"contentDisposition\": {\r\n \"type\": \"<string>\",\r\n \"parameters\": {},\r\n \"fileName\": \"<string>\",\r\n \"creationDate\": \"2023-11-07T05:31:56Z\",\r\n \"modificationDate\": \"2023-11-07T05:31:56Z\",\r\n \"readDate\": \"2023-11-07T05:31:56Z\",\r\n \"size\": 123\r\n },\r\n \"entity\": {},\r\n \"headers\": {},\r\n \"mediaType\": {\r\n \"type\": \"<string>\",\r\n \"subtype\": \"<string>\",\r\n \"parameters\": {},\r\n \"wildcardType\": true,\r\n \"wildcardSubtype\": true\r\n },\r\n \"messageBodyWorkers\": {},\r\n \"parent\": \"<unknown>\",\r\n \"providers\": {},\r\n \"parameterizedHeaders\": {}\r\n}\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"fields\"\r\n\r\n{}\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"parameterizedHeaders\"\r\n\r\n{}\r\n-----011000010111000001101001--"
headers = {"Content-Type": "multipart/form-data; boundary=---011000010111000001101001"}
response = requests.post(url, data=payload, headers=headers)
print(response.text){
"conflicts": [
"<string>"
],
"variablesWarnings": [
"<string>"
],
"variablesErrors": [
"<string>"
],
"variablesSubstitutions": [
"<string>"
],
"validationWarnings": [
"<string>"
],
"validationErrors": [
"<string>"
],
"importErrors": [
"<string>"
],
"importActions": [
"<string>"
],
"zipFileToken": "<string>",
"transformationMsgs": [
"<string>"
],
"status": "<string>"
}One of the following values:
abort: If there are conflicts, then import nothing.merge: If there are conflicts, then skip the conflicting objects.overwrite: If there are conflicts, then overwrite or delete/create the conflicting objects on the target system.abort, merge, overwrite The name of the Fusion app into which the objects will be imported.
The objects to import.
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
successful operation
Was this page helpful?