Batch Automation, Example Code


Example Python code showing how to use the Batch Automation with Media Storage and the Phone Number Verification API is available in the Syniverse Developer Community area on Github here.

This includes examples for both

  • Looking up detailed information for a list of phone numbers, available here
  • Monitoring a list of phone numbers by subscribing to notifications for lifecycle events such as porting or disconnection, available here.

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, and also your delivery configuration if you want to subscribe to notifications.

Example CURL Statements

Also, below are some example cURL statements, which can be used to:

  • Run a Phone Verification Scrub Job to look up phone number details
  • Run Phone Verification Monitor Job to subscribe to notifications
  • Run Phone Number Verification Unsubscribe Job to unsubscribe from notifications,
API Example Call
schedule, Scrub
curl -X POST -H "Authorization: Bearer [YOUR ACCESS TOKEN]" -H "Content-Type: application/json"  -d '{
    "schedule": {
    "jobId": "[YOUR JOB ID]",
    "name": "NIS Scrub",
    "inputFileId": "[UNIQUE FILE ID]",
    "fileRetentionDays": 30,
    "scheduleRetentionDays": 30,
    "outputFileNamingExpression": "NIS-Scrub-output.txt",
    "outputFileFolder": "Test",
    "outputFileTag": "Test Tag",
    "jobRuntimeContext": {}
    }
}' "https://api.syniverse.com/aba/v1/schedules"
		
schedule, Monitor
curl -X POST -H "Authorization: Bearer [YOUR ACCESS TOKEN]" -H "Content-Type: application/json" -d '{
    "schedule": {
        "jobId": "NIS-Monitor-v2",
        "name": "Subscribe",
        "inputFileId": "[UNIQUE FILE ID]",
        "outputFileNamingExpression": "",
        "outputFileFolder": "",
        "outputFileTag": "",
        "fileRetentionDays": 30,
        "scheduleRetentionDays": 30,
        "jobRuntimeContext": {
            "subscribeevents": "all",
            "subscribedestinationid": "[ID FOR EVENT MANAGER SUBSCRIPTION]"
        }
 }
}' "https://api.syniverse.com/aba/v1/schedules"
		
schedule. Unsubscribe
curl -X POST -H "Authorization: Bearer [YOUR ACCESS TOKEN]" -H "Content-Type: application/json" -d '{
    "schedule": {
        "jobId": "NIS-Unsubscribe-v2",
        "name": "Unsubscribe",
        "inputFileId": "[UNIQUE FILE ID]",
        "outputFileNamingExpression": "",
        "outputFileFolder": "",
        "outputFileTag": "",
        "fileRetentionDays": 30,
        "scheduleRetentionDays": 30,
        "jobRuntimeContext": {}
 }
}' "https://api.syniverse.com/aba/v1/schedules"
		

Copyright © 2017 Syniverse Technologies