Example Python code showing how to use Media Storage with Batch Automation and the Phone Number Verification API is available on Github.
The example code includes everything you need to upload, create and run a batch job and then download the results. Besides the example code, the repository also includes example input files and results. This means that once downloaded, the only code change needed is to add your access token.
Alternatively here are the cURL statements you would use to create and upload a file to MSS.
API | Example Call |
---|---|
Create a file reference |
curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer [YOUR ACCESS TOKEN] -d '{ "file_name": "", "file_tags": "" "app_name": "", "file_fullsize": "" }' "https://api.syniverse.com/mediastorage/v1/files" |
Upload file content |
curl -X POST -H "Content-Type: application/octet-stream" -H "Authorization: Bearer [YOUR ACCESS TOKEN]" -H "int-companyid: [YOUR COMPANY ID]" –F "file=@\test\numbers.txt" "https://api.syniverse.com/mediastorage/v1/files/[UNIQUE FILE ID]/content" |
Download file content |
curl -X GET -H "Authorization: Bearer [YOUR ACCESS TOKEN]" -H "int-companyid: [YOUR COMPANY ID]" –F "file=@\test\numbers.txt" "https://api.syniverse.com/mediastorage/v1/files/[UNIQUE FILE ID]/content" |
Retrieve list of files |
curl -X GET -H "Authorization: Bearer [YOUR ACCESS TOKEN]" "https://api.syniverse.com/mediastorage/v1/files" |
Delete file content |
curl -X DELETE -H "Authorization: Bearer [YOUR ACCESS TOKEN]" -H "int-companyid: [YOUR COMPANY ID]" "https://api.syniverse.com/mediastorage/v1/files/[UNIQUE FILE ID]" |