Developer Site

Callback URL for Published Media

This document describes how you can get data about a submitted media sent to your desired callback URL after you have approved/published it from the SendUs Media Manager.

The basic workflow

  1. Setup a file on your server with a script ready to receive JSON data
  2. Let the SendUs support team know what URL you want the callback sent to (it can be different URLs for different file formats, if you like - video, photo or image). support@sendus.com
  3. Publish a submitted media from the media manager
  4. The callback is triggered and the data is sent in JSON format to the URL where your file is hosted on the external server
  5. JSON decode the data
  6. Leverage the data however you would like

1. Setup a file on your server with a script ready to receive JSON data

Here is a PHP example showing how to get the data into a JSON decoded variable:

		<?php
$post_body=file_get_contents('php://input');
$post_body=json_decode($post_body, true);
//Then do something with the data in the $post_body variable
?>

Here’s an example that simply emails the JSON received to a specified email address. If you like, you can insert your email address and then use this for testing to make sure you successfully received the data.

		<?php
$post_body=file_get_contents('php://input');
$post_body=json_decode($post_body, true);
$post_body=json_encode($post_body);
mail("YourTestEmail@email.com","Subject Test",$post_body,"From: test@test123.com");
?>

2. Let a SendUs team member know what the URL is to that file (it can be different URLs for different file formats, if you like)

Please email your requested callback URLs to this email address so that we can record them in the SendUs platform:
support@sendus.com
Please use this format in your email:

Subject: Callback URL Request


Body:
Account: (your account title)
Video callback URL: (insert desired callback URL here)
Image callback URL: (insert desired callback URL here or use same as video)
Audio callback URL: (insert desired callback URL here or use same as video)

3. Publish a submitted media from the media manager

Please visit your media manager and publish a video, photo or audio file.

4. The callback is triggered and the data is sent in JSON format to the URL where your file is hosted on the external server

The SendUs platform will send data to your callback URL when the media has been published. This means any additional processing that needs to happen to the media before it is sent will occur at this time. For example, if a watermark needs to be added to a video file then it will complete this processing and then run the callback as soon as that process is complete. So if you have any of these additional processing settings enabled then you may notice a gap in time before you receive the callback.

5. JSON decode the data and leverage it how you would like

Below is an example of the JSON sent for one video file. In this example, the video file was created using the SendUs webcam recorder tool. This example was produced from the PHP example described in step #1 above.

	{"jsonrpc":"2.0",
	"method":"any_method",
	"params":[{
		"success":1,
		"submit":{
			"submit_id":19280,
			"submit_hash":"07tpkf",
			"submit_type":"video",
			"submit_status":"active",
			"submit_project_limit":"ok",
			"submit_is_original":1,
			"submit_is_public":1,
			"submit_is_vetted":1,
			"submit_is_conv":"converted_full",
			"submit_title":"cb1",
			"submit_time_create":1368831324,
			"submit_duration":3.92,
			"submit_url":"http:\/\/www.sendus.com\/sakiman12#!\/media\/07tpkf",
			"submit_user_id":0,
			"submit_in":0,
			"submit_out":3.92,
			"submit_price":0,
			"submit_media_id":31275,
			"submit_edit_id":0,
			"submit_callout_id":1402,
			"submit_project_id":337,
			"submit_project_title":"Sakiman12",
			"submit_frame_size":"640x480",
			"submit_rotate":0,
			"submit_project_url":"http:\/\/www.sendus.com\/sakiman12#!",
			"submit_user":null,
			"submit_external":{
				"youtube":["TBb2jwApxP0"]
				},
			"submit_description":"des",
			"submit_tag":["tag1"],
			"submit_original_file_url":"https:\/\/cgs-originals.s3.amazonaws.com\/hhwcxf.flv",
			"submit_view_file_url":[{
				"play_http_url":"http:\/\/d3v5bhls5me5se.cloudfront.net\/ng96rk8ea03apx2pndrqvfp6bpxqzh.mp4",
				"play_rtmp_url":["rtmp:\/\/rtmedia.citizenglobal.com\/cfx\/st","mp4:ng96rk8ea03apx2pndrqvfp6bpxqzh"],
				"play_start":0,
				"play_end":3.92,
				"play_duration":4.02,
				"format_title":"270p",
				"format_vbr":370,
				"format_abr":64,
				"format_vcodec":"H.264"
				},{
				"play_http_url":"http:\/\/d3v5bhls5me5se.cloudfront.net\/qqkiy2eyf237gojvrtie00ugt9mzc3.webm",
				"play_rtmp_url":["rtmp:\/\/rtmedia.citizenglobal.com\/cfx\/st","webm:qqkiy2eyf237gojvrtie00ugt9mzc3"],
				"play_start":0,
				"play_end":3.92,
				"play_duration":4.02,
				"format_title":"270p",
				"format_vbr":370,
				"format_abr":64,
				"format_vcodec":"WebM"
				},{
				"play_http_url":"http:\/\/d3v5bhls5me5se.cloudfront.net\/fkbhom3x8catvmw96eo3820u99frjf.mp4",
				"play_rtmp_url":["rtmp:\/\/rtmedia.citizenglobal.com\/cfx\/st","mp4:fkbhom3x8catvmw96eo3820u99frjf"],
				"play_start":0,
				"play_end":3.92,
				"play_duration":4,
				"format_title":"360p",
				"format_vbr":500,
				"format_abr":128,
				"format_vcodec":"H.264"
				},{
				"play_http_url":"http:\/\/d3v5bhls5me5se.cloudfront.net\/zx99g4j52ognoden7kubacp726b68t.webm",
				"play_rtmp_url":["rtmp:\/\/rtmedia.citizenglobal.com\/cfx\/st","webm:zx99g4j52ognoden7kubacp726b68t"],
				"play_start":0,
				"play_end":3.92,
				"play_duration":4,
				"format_title":"360p",
				"format_vbr":500,
				"format_abr":128,
				"format_vcodec":"WebM"
				},{
				"play_http_url":"http:\/\/d3v5bhls5me5se.cloudfront.net\/5fg7jsczqdz9xqtnm6gibe8iga8c8u.mp4",
				"play_rtmp_url":["rtmp:\/\/rtmedia.citizenglobal.com\/cfx\/st","mp4:5fg7jsczqdz9xqtnm6gibe8iga8c8u"],
				"play_start":0,
				"play_end":3.92,
				"play_duration":4,
				"format_title":"480p",
				"format_vbr":1000,
				"format_abr":256,
				"format_vcodec":"H.264"
				},{
				"play_http_url":"http:\/\/d3v5bhls5me5se.cloudfront.net\/pyjew85ftfi9wtkt3st8uyz6yyuuob.webm",
				"play_rtmp_url":["rtmp:\/\/rtmedia.citizenglobal.com\/cfx\/st","webm:pyjew85ftfi9wtkt3st8uyz6yyuuob"],
				"play_start":0,
				"play_end":3.92,
				"play_duration":4,
				"format_title":"480p",
				"format_vbr":1000,
				"format_abr":256,
				"format_vcodec":"WebM"
				}]
			}
		}],
	"id":"request-1368831972"}

	
  • The basic workflow
  • Step 1
  • Step 2
  • Step 3
  • Step 4
  • Step 5

©2013 CitizenGlobal, Inc.
X