The HW Blog

Want to be updated? @opencoconut | Feed

Ping Simplification

Bruno Celeste (@brunoceleste)

February 22, 2013 Features

For the sake of simplifying the Coconut API, we decided to group all the Ping parameters into one new, single ping_url. So now, instead of setting the ping_url_after_encode, ping_url_after_transfer and ping_url_if_error, you just need to set one ping_url in your Download and Job requests.

A short example:

curl -u HW-API-Key:apikey -X POST \
-d "video_id=19072468" \
-d "format_id=iphone_720p" \
-d "keep_video_size=true" \
-d "output_url=s3://accesskey:secretkey@bucket/my/object/file.mp4" \
-d "ping_url=http://mysite.com/coconut/ping" \
http://coconut.com/job.json

The HTTP URL you specified in the ping_url parameter will receive either success or error notification.

All in One Script

It is a slightly different approach, because all the different Pings are handled in a single script. This is why we have added a new POST parameter, coconut_ping_type, that comes along with the HTTP request so you know exactly what just happened.

Here are the different event types you may receive:

  • transfer      A video transfer has completed
  • encode         A video has finished being encoded
  • cdn_upload The encoded video has been uploaded to the given Output URL
  • thumbnails Thumbnail generation and upload have completed

To learn more, you can read the Ping Principle article that includes a comprehensive example of a Ping script that handles all of the types of Pings.

What happens to the other Ping parameters?

The other ping_url_* parameters won't go anywhere and will continue to work but you are encouraged to use the new ping_url parameter.



Any Comment? Send us a message on Twitter @opencoconut
If you have questions or feedbacks, you can also contact us via our contact page