API reference
Data Migrator exposes a REST API for use by external clients. These API resources provide equivalent functionality to the commands described in the Command reference except for the commands related to metadata migrations.
You can access the API documentation for Data Migrator directly on your host machine while Data Migrator is running:
http(s)://<ldm-hostname>:<ldm-port>/ldm-api.html
Your ldm-hostname
must be 127.0.0.1
or localhost
by default.
http://localhost:18080/ldm-api.html
To access the API documentation from your system's public IP address, follow the steps below.
Access REST API documentation on your network
Data Migrator's API documentation can only be viewed from the Data Migrator host machine by default. This prevents unauthorized access from other machines. However, if you need to access the documentation from another system over your network, take the following steps:
Open
/etc/wandisco/livedata-migrator/application.properties
.Delete or comment out the
server.address=127.0.0.1
line.Save the file changes.
Restart the Data Migrator service to apply the change. See System service commands - Data Migrator.
Check that access to the documentation is now available on your network:
Examplehttp://<ldm-hostname>:18080/ldm-api.html
Replace
ldm-hostname
with the host name or IP address of the system running thelivedata-migrator
service.(Optional) Once you have finished using the documentation, consider restoring the
server.address
entry to secure its access.
Metadata migrations
If you have upgraded to 2.6, properties controlling access to the Swagger docs on the Hivemigrator API have changed. Ensure your micronaut.security.intercept-url-map
values in /etc/wandisco/hivemigrator/application.properties
match the new default values for 2.6.
See Configuration property changes in the release notes for the new default values.
Commands related to metadata migrations (such as hive agent
, hive rule
, hive migration
) work through a different REST API port.
Access the API documentation for metadata migrations on your host machine:
http(s)://<hvm-hostname>:<hvm-port>/docs
Your hvm-hostname
must be 127.0.0.1
or localhost
by default.
http://localhost:6780/docs
Your hivemigrator
service host name is the same as your livedata-migrator
service host, but you must use port 6780 instead of port 18080 to connect to the hivemigrator
host.
Access metadata migration API documentation on your network
API documentation for metadata migration can only be viewed from the host machine by default. This prevents unauthorized access from other machines. However, if you need to access the documentation from another system over your network, take the following steps:
Open
/etc/wandisco/hivemigrator/application.properties
.Delete or comment out the line
micronaut.server.host=127.0.0.1
.Save the file changes.
Restart the Hive Migrator service to enable the new configuration. See System service commands - Hive Migrator.
Check that access to the documentation is now available on your network:
Examplehttp://hvm-hostname:6780/docs
Replace
hvm-hostname
with the host name or IP address of the system running thehivemigrator
service.(Optional) Once you have finished using the documentation, consider restoring the
server.address
entry to secure its access.
Accessing endpoints with common web client tools
You can also access the API endpoints listed in the Swagger API reference interface using commonly available tools such as cURL.
curl -X 'GET' 'http://10.6.123.124:18080/stats'
Find all endpoints and methods available for your current version, along with examples, by viewing the Data Migrator Swagger API reference or Hive Migrator Swagger API reference.
If you've applied Basic Authentication or API LDAP Access control, construct your requests with either Basic or Bearer authentication.
Using Basic authentication
curl -u admin:password -X 'POST' 'http://<host>:18080/fs/targets/adls2/shared-key/adlsTarget%20?listenAndApplySourceChanges=false' -H 'accept: application/json -H 'Content-Type: application/json' -d '{"sharedKey":"ThisIsAShar3rK3y==", "endpoint": "dfs.core.windows.net", "accountName": "mYAccount", "containerName": "container1", "insecure": false, "additionalProperties": { "fs.azure.concurrentRequestCount.in": "4", "fs.azure.write.request.size": "16384"}}'
Using Bearer authentication
Obtain a JSON Web Token using the /authentication/authenticate
endpoint, then supply the token with your request.
curl -u admin:password -H 'POST' 'http://<host>:18080/authentication/authenticate' -H 'accept: application/json' -H 'Content-Type: application/json' -d '{"userName": "John.Smith@company.com","password": "pass123"}'
curl -H "Authorization: Bearer eyJhbGB3arerTok3nExampl3y7gieWA" \
-X 'POST' \
'http://<host>:18080/fs/targets/adls2/shared-key/adlsTarget%20?listenAndApplySourceChanges=false' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-d '{"sharedKey":"ThisIsAShar3rK3y==", "endpoint": "dfs.core.windows.net", "accountName": "mYAccount", "containerName": "container1", "insecure": false, "additionalProperties": { "fs.azure.concurrentRequestCount.in": "4", "fs.azure.write.request.size": "16384"}}'