Uploading Files to DEFT (deft.dell.com) with curl

DEFT (Dell Engineering File Transfer) accepts plain HTTP basic auth on its JSON API —
no browser session or cookies needed. Uploads happen in two steps:
create an upload operation, then PUT the file data to it.

Replace USER:PASS with your DEFT credentials and quote the password
(it may contain # or other shell metacharacters).

1. Create an upload operation

curl -sS -u 'USER:PASS' \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{"operation":"Upload","filePath":"/<remote-name>","customAttributes":{"transferMode":"BINARY"}}' \
  https://deft.dell.com/api/v2.0/fileOperations

The response contains the operation id used in the next step:

{ "id" : "872106fb-3857-4f14-96b4-44c7a2708154", "status" : "IN_PROGRESS", ... }

2. Upload the file data

Send the raw file as the body of a PUT to the operation URL. Provide the total
size via Content-Range (this is what tells the server the transfer is complete):

SIZE=$(stat -c%s file.tar.gz)
MD5=$(md5sum file.tar.gz | cut -d' ' -f1 | xxd -r -p | base64)

curl -sS -u 'USER:PASS' \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/octet-stream' \
  -H 'Features: DNDISP;UPDISP' \
  -H "Content-Range: bytes 0-$((SIZE-1))/$SIZE" \
  -H "Content-MD5: $MD5" \
  -T file.tar.gz \
  https://deft.dell.com/api/v2.0/fileOperations/<op-id>

Notes:

  • The server may answer 404 Asynchronious operation ... not found right after
    the operation was created (async registry propagation). Retry the PUT.
  • Content-MD5 (base64-encoded binary MD5) is optional but recommended; it lets
    the server verify integrity.
  • Large files work in a single PUT (the configured chunk size is 100 MB); for
    resumable transfers the same PUT accepts Content-Range chunk by chunk.

3. Verify

List the home directory and check size and transferStatus (Done):

curl -sS -u 'USER:PASS' -H 'Accept: application/json' \
  'https://deft.dell.com/api/v2.0/files?path=%2F&sortBy=fileName&order=ASC&limit=50&offset=0'

Download the file back and compare checksums:

curl -sS -u 'USER:PASS' -o verify.tar.gz \
  https://deft.dell.com/api/v2.0/files/<remote-name>
sha256sum verify.tar.gz file.tar.gz

Housekeeping

Delete no-longer-needed files (returns 204):

curl -sS -u 'USER:PASS' -X DELETE -H 'Accept: application/json' \
  https://deft.dell.com/api/v2.0/files/<remote-name>

Reference

EndpointMethodPurpose
/api/v2.0/fileOperationsPOSTCreate operation (Upload)
/api/v2.0/fileOperations/<id>PUTUpload file data
/api/v2.0/fileOperations/<id>GETOperation status
/api/v2.0/files?path=%2F&...GETList home directory
/api/v2.0/files/<name>GETDownload a file
/api/v2.0/files/<name>DELETEDelete a file

Leave a Reply