If the users API key is not known. You can make a POST request to /login, i.e. https://filetransfer.example.com/login and it will return the api key.
Request
| Parameter | Description |
|---|---|
| The email (or username) for the user | |
| password | The password for the user |
The email needs to match how you login users to the appliance. This means that if you authenticate users with LDAP/AD and search users with sAMAccountName, this will match the shortname for users, and subsequently, “email” in this case needs to be the shortname for the user.
The API key is persistent so you only need to request it if it's not known in the client. When it is known, you can save it and not prompt the user to login again.
Example Request
<?xml version="1.0" encoding="UTF-8"?> <user> <email>user@example.com</email> <password>password</password> </user>
Response
| Response | Type | Description |
|---|---|---|
| api_key | string | The users API key. |
Example Response
<?xml version="1.0" encoding="UTF-8"?> <user> <api_key>4i1Rkf3pkxu0OCRuSuTMqE</api_key> </user>
The following shell script will retrieve the api key for the user with email user@company.com.
#!/bin/sh email="user@company.com" password="secret" base_url="https://filetransfer.company.com" cat <<EOF | curl -k -s -X POST -H 'Content-Type: text/xml' -d @- $base_url/login <?xml version="1.0" encoding="UTF-8"?> <user> <email>$email</email> <password>$password</password> </user> EOF