------------------------
	Simple Advertisement Retrieval Protocol (SARP) Version 0.5
	------------------------
	
	SARP requires the SRX method of sending and receiving messages via HTTP GET/POST
	and XML response. The following is the specification of messages provided in 
	SARP. The SRX protocol specification is located here.
	
	An SARP response must include <sarp> as the first element with a version attribute indicating 
	the SARP specification version used in the format #.#.
	
	1) Query Ads (for targeted ad placements only)
        Form elements:
            type (string: "channel", "show", "season", or "episode")
            id               (string representing the id of the channel, show, etc.)
            gender           (string: "male", "female", or "both", only applies to channel type)
            age_min, age_max (integers, only apply to channel type)
            timeslot         (two 24hr timecodes as hh:mm separated by "-", ex: "19:00-22:00")
            limit            (integer, max number of results to be returned)

	Example XML Response:
        <sarp version=x.x>
            <adList count=35>
                <targetedAd id=33>
                <location>http://server.domain/path/to/Commercials/ad_file.mp4</location>
                <fingerprint algorithm=sha1>l4k34lkj34lk3</fingerprint>
                <targetMap>
                    <targetAgeMin>18</targetAgeMin>
                    <targetAgeMax>35</targetAgeMax>
                    <targetGender>female</targetGender>
                    <placement>
                        <type>channel</type>	
                        <id>5</id>
                        <startDate>dd</startDate>
                        <endDate>5</endDate>
                        <timeSlot>5</timeSlot>
                        <postalCodes>00000-00000,00000-00000,00000-00000</postalCodes>
                    </placement>
                    ...
                </targetMap>
                </targetedAd>
                ...
            </adList>
            <adListSignature>
            ...
            </adListSignature>
        </sarp>

	Allowed Error Responses:
	UNKNOWN_ERROR = [-1, 'Unknown Error']
	
	Each individual ad may be retrieved using an SCTP Get Content request.


	2) Get Ad Map
	    Returns an ordered list of ads placed on the specified content , signs the list via 
	    XML-Signature standard 
	
        Form elements: 
            guid     (string representing the content's unique id)

        Example XML Response:
            <Envelope>
                <sarp version=x.x>
                    <response> Standard SRX response code and message </response>
                    <adMap>
                        <commercialBreaks>123.11,456.22,987.33</commercialBreaks>
                        <contentGuid>1234567890</contentGuid>
                        <advertisements>
                            <advertisement type="required" id="12345">
                                <playType> c </playType>  
                                <url> http://server.domain/path/to/Commercials/ad_file.mp4 </url>
                                <digest algorithm="md5"> 1234567890abcdef </digest>
                                <dateStart> 2008-01-01 </dateStart>
                                <dateEnd> 2008-02-01 </dateEnd>
                                <duration> 34 </duration>
                                <forcePlay> true </forcePlay>
                                <minPlaySeconds> 5 </minPlaySeconds>
                            </advertisement>
                            ⋮
                        </advertisements>
                    </adMap>
                </sarp>
                <Signature>
                    XML-Signature of the sarp node (see http://www.w3.org/TR/xmldsig-core/ 
                    and http://www.w3.org/2000/09/xmldsig)
                </Signature>	
            </Envelope>
            
        Node Glossary:
            <commercialBreaks>   a comma separated list of commercial break points in the content, 
                                 break points are decimal seconds down to 100ths of a second (see example above)
            <playType>           the playback mode for the ad, possible values are 'c' and 'o',
                                 where c=commerical, o=overlay
            <url>                the location to download the ad file from 
            <dateStart>          the date the ad became available for playback
            <dateEnd>            the date the ad stops being valid
            <duration>           the length of the ad in seconds
            <forcePlay>          true or false value indicating whether some portion of the ad must be played
            <minPlaySeconds>     the minimum number of seconds to play the ad if forcePlay is true
            

        Allowed Error Responses:
            SUCCESS           = [ 1, 'Your transaction has completed.']
            CONTENT_NOT_VALID = [-3, 'The item you are requesting is not valid.']
            INPUT_ABSENT      = [-17, 'Please fill in all required information.']
	
	
	3) Get Target Map
        Form elements: 
            id (string representing the ad id)

        Example XML Response:
            <Envelope>
                <sarp version=x.x>
                    <targetMap>
                        <targetAgeMin>18</targetAgeMin>
                        <targetAgeMax>35</targetAgeMax>
                        <targetGender>female</targetGender>
                        <placement>
                            <type>channel</type>	
                            <id>5</id>
                            <startDate>2008-01-01</startDate>
                            <endDate>2008-12-31</endDate>
                            <timeSlot>5</timeSlot>
                            <postalCodes>00000-00000,00000-00000,00000-00000</postalCodes>
                        </placement>
                        ...
                    </targetMap>
                </sarp>
                <Signature>
                ...
                </Signature>	
            </Envelope>
            
        Allowed Error Responses:
            UNKNOWN_ERROR = [-1, 'Unknown Error']
            USER_NOT_LOGGED_IN = [-8, 'User Not Logged In']
	

        Note: Success returns URL to content file and a DRM action token if required.

	
This specifications provided here are licensed to the public under a Creative Commons Attribution 3.0 license.