⚠Due to planned maintenance you will experience short (<30 min) downtime between 08:00 - 08:30 CET.
...
URL | |
---|---|
SERVER URL | sandbox system: https://sandbox-datamanager-api.wmda.info Production system: https://datamanager-api.wmda.info |
URI | /api/v1/files/upload Explanations:
|
METHOD | POST |
Full URL path example | For donor for organization with ION-1234, the full path is as below: https://sandbox-datamanager-api.wmda.info/api/v1/files/upload |
Request form | |
HEADER | Authorization and Content-Type are required, the other ones are optional |
Authorization | Bear Token |
Content-Type | application/octet-stream (when your file < 128K) multipart/form-data (when your file >128K) From , Content-Type is required. |
cX-Rename-If-Exists | true |
SAMPLE Request
First test the connection by using the right path and fetching the metadata : it should result in a response 200 OK.
- Look carefully at the path : here we use ion0999, that should be replaced by your ION.
- You may notice that we add the filename to the path: depending on the library you may need to add that
Upload
Now we know the path is correct and we can do an upload using cURL:
Upload
Below is suggestion for curl call based on the swagger docBelow is the invalid to deploy, currently it is still available in PRODUCTION till production maintenance. But not available any more in STAGING dataupload.
Code Block | ||
---|---|---|
| ||
curl -i -X PUT -H "Authorization:Basic d21.....uZT==" -T "./test.pgp" POST --location 'https://stagingsandbox-datamanager-datauploadapi.wmda.info/api/v2v1/iofiles/ION0999/' |
Below are suggestions with more secure headers:
Warning |
---|
The curl script needs update to upload in STAGING from Oct, 27th, 2022 after maintenance/update . And the new suggested script can be used in PRODUCTION as well. So we strongly suggest API users to update, then there will be less stress after PRODUCTION update/maintenance. |
Suggestion 1:
...
Code Block | ||
---|---|---|
| ||
curl -i -X PUT -H "Authorization:Basic d21.....uZT==" -H "upload' \ --header 'Authorization: Bearer ••••••' \ --header 'Content-Type: multipart/form-data" ' --data-binary "@/path/to/file/ION-0999-D.gpg" "https://staging-dataupload.wmda.info/api/v2/io/ION0999/" -H "X-File-Name:ION-0999-D.gpg" |
Code Block | ||
---|---|---|
| ||
curl -i -X PUT -H "Authorization:Basic d21.....uZT==" -H "Content-Type: multipart/form-data" --data-binary "form 'file=@c:/path/to/file/ION-0999-D.gpg" "https://staging-dataupload.wmda.info/api/v2/io/ION0999/" -H "X-File-Name:ION-0999-D.gpg" |
Suggestion 2:
For files that encrypted and identified as PGP/GPG MESSAGE (open the encrypted file and you can see this info), then -F and -H options also work. -F already included "Content-Type: multipart/form-data", so no need to provide it any more.
For binary file, extra header information will be added to the content of the file when file is uploaded, and then it can not be decrypted any more, so please use suggestion 1 to upload.
Code Block | ||
---|---|---|
| ||
curl -i -X PUT -H "Authorization:Basic d21.....uZT==" -F "file="@/path/to/file/ION-0999-D.gpg" "https://staging-dataupload.wmda.info/api/v2/io/ION0999/" -H "X-File-Name:ION-0999-D.gpg" |
Code Block | ||
---|---|---|
| ||
curl -i -X PUT -H "Authorization:Basic d21.....uZT==" -F "file="@c:/path/to/file/ION-0999-D.gpg" "https://staging-dataupload.wmda.info/api/v2/io/ION0999/" -H "X-File-Name:ION-0999-D.gpg" |
' \
--form 'ion="9999"' \
--form 'folder="upload"' |
Download
Download reports
You may use the API also to fetch your reports . Unfortunately, it is not one line cmd, and And you may need 2 steps.
1.Fetch the files list and get the file names.
Use the following curl and endpoint to fetch an array with filedescriptors: url should use double quote or no quote in windows envof file list for the folder ""report:
Code Block |
---|
curl --H "Authorization:Basic d21.....uZT==" location 'https://stagingsandbox-datamanager-datauploadapi.wmda.info/api/v2v1/fs/reports-ion0999/?children=f |
You will get the result in xml format, and you can get json format, use the cmd below:
Code Block |
---|
curl -H "Authorization:Basic d21.....uZT==" https://staging-dataupload.wmda.info/api/v2/fs/reports-ion0999/?children=f&format=jsonfiles/list' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer ••••••' \ --data '{ "ion": 9999, "folder": "report" }' |
2. Fetch all the reports or the one you need. Note, you need to use "io" instead of "fs" in the path.
Code Block |
---|
curl -O GET -H "Authorization:Basic d21.....uZT==" location 'https://stagingsandbox-datamanager-datauploadapi.wmda.info/api/v2v1/io/reports-ion0999/$filenamefiles/download' \ -o-header '$filename.txt' |
In windows cmd, the -o dose not work, and the cmd is as below:
Code Block |
---|
curl -H "Authorization:Basic d21.....uZT==" https://staging-dataupload.wmda.info/api/v2/io/reports-ion0999/$filename > $filename.txt |
Download archived files
Download archived files will be the same as download reports. And 2 steps as above are needed.
The example URL for archive folder is as below:
Code Block |
---|
https://staging-dataupload.wmda.info/api/v2/fs/archive-ion0999/?children=fContent-Type: application/json' \ --header 'Authorization: Bearer ••••••' \ --data '{ "ion": 9999, "folder": "report", "fileName": "ION-0999-C.gpg" }' |
In RESTLET :
Click on Code to get raw CURL syntax:
...