Page tree
Skip to end of metadata
Go to start of metadata

 To create a live streaming CDN resource, use the following request:

POST /cdn_resources.xml
POST /cdn_resources.json

XML Request example (with external publishing point )

curl -i -X POST -d '<cdn_resource><cdn_hostname>onapp.stream.resource</cdn_hostname><edge_group_ids type="array"><edge_group_id type="integer">1</edge_group_id></edge_group_ids><resource_type>STREAM_LIVE</resource_type><publishing_point>external</publishing_point><publishing_location>www.google.com</publishing_location><failover_publishing_location>rtmp://test.com/test</failover_publishing_location></cdn_resource>' -u user:userpass http://onapp.test/cdn_resources.xml -H 'Accept: application/xml' -H 'Content-type: application/xml'

JSON Request example (with external publishing point )

curl -i -u user:userpassword -X POST http://onapp.test/cdn_resources.json -H 'Accept: application/json' -H 'Content-type: application/json' -d '{"cdn_resource":{"cdn_hostname":"onapp.stream.resource","resource_type":"STREAM_LIVE","edge_group_ids":[7],"publishing_point":"external","publishing_location":"rtmp://test.me/test","failover_publishing_location":"rtmp://test.com/test"}}'

XML Request example (with internal publishing point )

curl -i -X POST -d '<cdn_resource><cdn_hostname>onapp.stream.resource</cdn_hostname><edge_group_ids type="array"><edge_group_id type="integer">1</edge_group_id></edge_group_ids><resource_type>STREAM_LIVE</resource_type><publishing_point>internal</publishing_point><publishing_location>532</publishing_location><failover_publishing_location>128</failover_publishing_location></cdn_resource>' -u user:userpass http://onapp.test/cdn_resources.xml -H 'Accept: application/xml' -H 'Content-type: application/xml'

JSON Request example (with internal publishing point )

curl -i -u user:userpass -X POST http://test/cdn_resources.json -H 'Accept: application/json' -H 'Content-type: application/json' -d '{"cdn_resource":{"cdn_hostname":"onapp.stream.resource","resource_type":"STREAM_LIVE","edge_group_ids":[7],"publishing_point":"internal","publishing_location":"532","failover_publishing_location":"128"}}'



Where:

cdn_hostname* - specify the name which will serve as a label only

resource_type*STREAM_LIVE

publishing_point* - the publishing point type: external or internal

publishing_location*- specify the URL address for external publishing point. Set the ID of a location that will serve as a publishing point for internal type.

failover_publishing_location - publishing point failover URL for external publishing point. Specify the ID of a location that will serve as a failover publishing point for internal type.

edge_group_ids* - indicate the ID(s) of required CDN edge groups


Response

You will get a response consisting of two parts - the header with HTTP status code (see Introduction for details) and the response body including the parameters. At this stage some of the parameters can be empty. This is expected behavior, because the full process of creation takes some time, and remote service cannot fill in the parameters at this time. For the complete list of parameters use GET request.

 

  • No labels