<!-- Intent: Update a Voice_Message with voicecode 123456 --> <?php $url = 'http://api.v4.swiftreach.com/api/Messages/Voice/Update/123456'; $authToken = '123456'; $jsonString = ' { "AutoReplays":0, "RoutingPhone":"2012361344", "EnableAnsweringMachineMessage":false, "ContentProfile":[{ "SpokenLanguage":"English", "TTY_Text":null, "VoiceItem":[{ "VoiceItemType":1, "AudioSource":[{ "$type":"SwiftReach.Swift911.Core.Messages.Voice.AUDIO_SOURCE_VOICE, SwiftReach.Swift911.Core", "VoiceCode":100307, "Content":"this is just a test. press any key and you can talk to someone.", "AutoGenerateVoice":false, "FileVersion":0, "AudioType":0 }] }] }], "DefaultSpokenLanguage":"English", "BridgeDTMF":null, "CallerID":"2012361344", "CapacityLimit":0, "RingSeconds":60, "CongestionAttempts":3, "AutoRetries":0, "AutoRetriesInterval":3, "EnableWaterfall":false, "EnableAnsweringMachineDetection":false, "CreateStamp":"2012-09-21T17:31:41.06", "ChangeStamp":"2012-09-21T17:31:41.06", "LastUsed":"0001-01-01T00:00:00", "CreatedByUser":"sample", "ChangedByUser":"", "Name":"The Voice Link", "Description":"this is a test", "VoiceCode":123456, "VoiceType":17, "Visibility":0, "DeleteLocked":false }'; $headers = array( 'Content-type: application/json', 'SwiftAPI-Key: ' . $authToken, 'Accept: application/json', 'Expect:' ); $ch = curl_init(); $args = array( CURLOPT_URL => $url, CURLOPT_FOLLOWLOCATION => TRUE, CURLOPT_RETURNTRANSFER => TRUE, CURLOPT_CUSTOMREQUEST => "PUT", CURLOPT_POSTFIELDS => $jsonString, CURLOPT_HTTPHEADER => $headers, ); curl_setopt_array($ch, $args); $res = curl_exec($ch); $res_data = json_decode($res, true); print($res_data); ?> <!-- example return value --> { "AutoReplays":1, "RequireResponse":false, "ValidResponses":"", "EnableAnsweringMachineMessage":false, "ContentProfile":[{ "SpokenLanguage":"English", "TTY_Text":"This is what I want to show up on a TTY", "VoiceItem":[{ "VoiceItemType":1, "AudioSource":[{ "$type":"SwiftReach.Swift911.Core.Messages.Voice.AUDIO_SOURCE_TTS_TEXT, SwiftReach.Swift911.Core", "TTSText":"This is the message.", "AudioType":2 }] }] }], "DefaultSpokenLanguage":"English", "CallerID":"2012361344", "CapacityLimit":0, "RingSeconds":60, "CongestionAttempts":3, "AutoRetries":0, "AutoRetriesInterval":3, "EnableWaterfall":false, "EnableAnsweringMachineDetection":false, "CreateStamp":"0001-01-01T00:00:00", "ChangeStamp":"0001-01-01T00:00:00", "LastUsed":"0001-01-01T00:00:00", "CreatedByUser":null, "ChangedByUser":null, "Name":"API Voice Message", "Description":"created by api", "VoiceCode":123456, "VoiceType":14, "Visibility":0, "DeleteLocked":false }