⚠Due to planned maintenance you will experience short (<30 min) downtime between 08:00 - 08:30 CET.
...
This document describes the mechanism via the REST API method with curl commands.
Request and implement credential
First time request
If you are not an API user yet, and plan to automate your file handling processedprocess. Then please request an API credential from WMDA support team to email support@wmda.info. And please follow steps below:
- Send email to support@wmda.info with a GPG public key. Or if you have other secure way to communicate the credential.
- WMDA will provide you the credential and send email to notify you.
- You test the credential is working and can upload a file in sandbox system. You can follow the steps below to test the credential:
- Implement the credential.
- Refresh Bear upload user guide below.
Implement credential
Data Manager uses Bear Token for the authorization as all WMDA API services, please follow user guide for API authentication to implement https://share.wmda.info/x/8I7RFw.
Update credential because of expiration
WMDA credential only available for one year currently. If your credential is expired, please send to WMDA support team to request a new one.
Currently, WMDA is implementing a new feature to let API user to request a new credential by themselves before the credential expires, we will send announcement when this feature is available.
Refresh Bear Token
Using the REST API
To get more knowledge for usage of curl, we recommend member to read the doc for curl https://ec.haxx.se/usingcurl-netrc.html.
There are 2 steps
Step 1: Request the credential from WMDA if you are not a API user yet.
Step 2: Test to use the API in WMDA Data Manager .
You can use the API doc in swaggerAPI specification is in the swagger doc: https://brave-forest-04a379103.azurestaticapps.net/?urls.primaryName=Data%20Manager%20Data%20Exchange%20API#/
Below is an example to guide how to upload a file:
Step 3: Implement the API.
If you are already familiar with the API implementation, then you can skip Step 2, and test from your own implementation.
1: Set up the credential by following the instruction in the "Implement credential"
Step 2: Test to use the API in WMDA Data Manager sandbox.
Below is an example to guide how to get the information to upload a file:
URL | |
---|---|
SERVER URL | sandbox Sandbox system: https://sandbox-datamanager-api.wmda.info Production system: https://datamanager-api.wmda.info |
URI | /api/v1/files/upload |
METHOD | POST |
Full URL path exampleFor donor for organization with ION-1234, the full path is as below: | https://sandbox-datamanager-api.wmda.info/api/v1/files/upload |
Request form | --form 'file=@c:/path/to/file/ION-<yourion>-D.gpg' \
--form 'ion="<yourion>"' \
--form 'folder="upload"' |
HEADER | Authorization and Content-Type are required, the other ones are optional |
Authorization | Bear Token |
Content-Type | multipart/form-data |
Step 3:
Run curl call as below to upload a file:
Code Block | ||
---|---|---|
| ||
curl -i POST 'https://sandbox-datamanager-api.wmda.info/api/v1/files/upload' \
--header 'Authorization: Bearer ••••••' \
--header 'Content-Type: multipart/form-data'
--form 'file=@c:/path/to/file/ION-0999-D.gpg' \
--form 'ion="9999"' \
--form 'folder="upload"' |
Upload
Below is suggestion for curl call based on the swagger doc
...
Code Block |
---|
curl --location 'https://sandbox-datamanager-api.wmda.info/api/v1/files/download' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer ••••••' \ --data '{ "ion": 9999, "folder": "report", "fileName": "ION-0999-C.gpg<filename>.txt" }' |
In RESTLET :
...
Response should be 200:
Download full dataset
For those registries that are permitted to use the full dataset the statement below will fetch that. Please change the ION workspace to match your ION.You can download the file in the folder "download"
Code Block |
---|
curl POST -O GET -H "Authorization:Basic .............." -location 'https://datauploadsandbox-datamanager-api.wmda.info/api/v2v1/io/downloads/ION1804/bmdw4data.zip.gpgfiles/download' \ -o-header 'wmda_data_v22.zip.gpg' |
In windows cmd, the -o dose not work, and the cmd is as below:
Code Block |
---|
curl -H "Authorization:Basic .............." "https://dataupload.wmda.info/api/v2/io/downloads/ION1804/bmdw4data.zip.gpg" > wmda_data_v22.zip.gpg |
We noticed sometimes the download maybe terminated because of some temp network limitation, and the "-C -" option can be used to continue the download.
-v is for more details of the track info
Code Block |
---|
curl -v -H "Authorization:Basic .............." -o 'wmda_data_v22.zip.gpg' -C - 'https://dataupload.wmda.info/api/v2/io/downloads/ION1804/wmda_data_v22.zip.gpg' |
FAQ
Question : My report states : File could not be processed due to a file decryption error, when using the API upload? Why?
Answer :
Expand |
---|
The Dataupload's API endpoint /io streams file(s) directly to the workspace. We have detected that premature file pickups may occur and attempt to move/delete files while content is still being appended or processed. We have taken actions to reduce this behaviour by decreasing the frequency for file pickup which in turn does lower the chance for premature pick. We have also implemented gpg error validation to check integrity based on its messages. Note: Files are picked from the workspaces for processing every 10 minutes. And file will only picked up if it is not updated for 5 mins. Some key messages:
Content-Type: application/json' \
--header 'Authorization: Bearer ••••••' \
--data '{
"ion": 9999,
"folder": "download",
"fileName": "wmda_data_v22.zip.gpg"
} |