Import Metadata
Import a G&L metadata file sent as the request body.
POST https://instance.securid.com/aveksa/command.submit?cmd=importMetadata
Request
Parameters
| importMetadata | |
| format | properties - (Default) Returns the response as key=value pairs.json - Returns the response as JSON. |
| filename | The filename in the import directory on the G&L server. The import directory is specified on the Web Services configuration page. Not recommended. Send the file as the request body instead. |
| overwrite | true - Overwrite existing objects.false - (Default) Skip existing objects. |
Headers
Bearer token | |
| Accept | application/json |
| Content-Type | application/xml |
Body
Send the metadata XML file as the raw request body. The metadata file format is produced by the RSA G&L export function (Admin > Metadata > Export).
<AveksaMetadataFile>
<FileManifest>
<exportDate>2024-01-01 00:00:00.000 UTC</exportDate>
<systemVersion>8.0.0</systemVersion>
<buildNumber>188886</buildNumber>
<patches>P10_HF01</patches>
<userName>admin</userName>
<numberOfEntries>1</numberOfEntries>
<entries>
<entry objectType="CRButton" name="Object Name" primaryKey="1">
<m__warnings/>
</entry>
</entries>
</FileManifest>
<!-- Exported objects follow -->
</AveksaMetadataFile>
Response
Parameters
type | Executed command name |
status | success or failure |
num-success | The number of objects successfully imported. |
num-failure | The number of objects that failed to import. |
message | Optional message returned with the status. |
Examples
Request
- Curl
- Python
- Node.js
curl -K -X POST \
"https://instance.securid.com/aveksa/command.submit?cmd=importMetadata&format=json&overwrite=true" \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/xml" \
-d '<AveksaMetadataFile>
<FileManifest>
<exportDate>2024-01-01 00:00:00.000 UTC</exportDate>
<systemVersion>8.0.0</systemVersion>
<buildNumber>188886</buildNumber>
<patches>P10_HF01</patches>
<userName>admin</userName>
<numberOfEntries>0</numberOfEntries>
<entries/>
</FileManifest>
</AveksaMetadataFile>'
import requests
url = "https://instance.securid.com/aveksa/command.submit"
params = {
"cmd": "importMetadata",
"format": "json",
"overwrite": "true"
}
headers = {
'Authorization': 'Bearer <token>',
'Content-Type': 'application/xml'
}
body = """<AveksaMetadataFile>
<FileManifest>
<exportDate>2024-01-01 00:00:00.000 UTC</exportDate>
<systemVersion>8.0.0</systemVersion>
<buildNumber>188886</buildNumber>
<patches>P10_HF01</patches>
<userName>admin</userName>
<numberOfEntries>0</numberOfEntries>
<entries/>
</FileManifest>
</AveksaMetadataFile>"""
response = requests.post(url, data=body, params=params, headers=headers)
if response.status_code == 200:
print(response.json())
else:
print(f"Request failed with status code {response.status_code}")
const axios = require('axios');
const url = "https://instance.securid.com/aveksa/command.submit";
const params = {
cmd: "importMetadata",
format: "json",
overwrite: "true"
};
const headers = {
'Authorization': 'Bearer <token>',
'Content-Type': 'application/xml'
};
const body = `<AveksaMetadataFile>
<FileManifest>
<exportDate>2024-01-01 00:00:00.000 UTC</exportDate>
<systemVersion>8.0.0</systemVersion>
<buildNumber>188886</buildNumber>
<patches>P10_HF01</patches>
<userName>admin</userName>
<numberOfEntries>0</numberOfEntries>
<entries/>
</FileManifest>
</AveksaMetadataFile>`;
axios.post(url, body, { params, headers })
.then(response => {
if (response.status === 200) {
console.log(response.data);
} else {
console.log(`Request failed with status code ${response.status}`);
}
})
.catch(error => {
console.error('Error:', error);
});
Response
- 200 Success
- 200 Failure
- 400 No Body
- 400 Filename Config
- 500 Malformed XML
- 401 Invalid Token
- 401 No Token
{
"data": {
"type": "importMetadata",
"status": "success",
"num-success": "3",
"num-failure": "0"
}
}
Returned when overwrite=false (default) and objects in the file already exist. HTTP status is still 200. Check status in the response body.
{
"data": {
"type": "importMetadata",
"status": "failure",
"num-success": "0",
"num-failure": "3",
"message": "The following errors occurred:\ncom.aveksa.server.core.DuplicateNameException: Object Name already exists and no overwrite was specified\ncom.aveksa.server.core.DuplicateNameException: Another Object already exists and no overwrite was specified"
}
}
Returned when the request body is missing.
<html>
<head>
<title>Error</title>
</head>
<body>File should be passed to import the metadata
Query String=cmd=importMetadata&format=json</body>
</html>
Returned when filename is used but no import directory is configured on the Web Services settings page.
<html>
<head>
<title>Error</title>
</head>
<body>The filename parameter cannot be used until the import directory is configured in the Web Services configuration screen.File should be passed to import the metadata
Query String=cmd=importMetadata&format=json&filename=test.xml</body>
</html>
Returned when the request body is not valid XML.
<html>
<head>
<title>Error</title>
</head>
<body>com.aveksa.common.AveksaSystemException: com.thoughtworks.xstream.io.StreamException: </body>
</html>
<html>
<head>
<title>Error</title>
</head>
<body>The token is not valid for the command 'importMetadata'. Token is invalid or expired</body>
</html>
<html>
<head>
<title>Error</title>
</head>
<body>The token is required for the command 'importMetadata'</body>
</html>
Verified with RSA Governance & Lifecycle version 8.0.0.188886 P10_HF01.