BrightSignNetwork (BSN) Main A...
Main REST HTTP API version 201...
Upload Endpoints (2017/01)
17min
use this endpoint to upload files to the network webpages are uploaded as a collection of files in an upload session, while all other files are uploaded individually without a session marker calls to the /sessions/ endpoints require unique accept and content type header values (outlined below) failing to include these header values will prompt a code 406 response from the server unlike other bsn rest endpoints, the upload url contains the "upload" path before the api version base url for these endpoints https //api brightsignnetwork com/upload/2017/01/rest/sessions upload workflow webpages these steps outline how to upload a webpage (i e an html file and associated asset files) the client makes a post call to the /sessions/ endpoint with the following content type value application/vnd bsn start webpage upload arguments 201701+json the post request body includes information about the html file and associated asset files (including the path of each asset file relative to the html file) the response body includes a token for the webpage upload session, as well as an upload token for each file that is part of the webpage the client begins uploading the webpage html file by calling put on the /sessions/{sessiontoken}/uploads/{uploadtoken}/ endpoint with the following content type value application/vnd bsn start webpage asset upload arguments 201701+json the client uploads the file to the server by calling post on the /sessions/{sessiontoken}/uploads/{uploadtoken}/chunks/ endpoint if the file is larger than approximately 256kb, the client will need to make multiple post calls and use the ?offset url parameter to segment the file into chunks once the file chunk(s) have been uploaded, the client completes the html file upload by calling put on the /sessions/{sessiontoken}/uploads/{uploadtoken}/ endpoint with the following content type value application/vnd bsn complete webpage asset upload arguments 201701+json the client repeats steps 2 through 4 for each asset file associated with the html file once all files have been uploaded, the client completes the webpage upload session by calling put on the /sessions/{sessiontoken}/ endpoint with the following content type application/vnd bsn complete webpage upload arguments 201701+json the response body will include the new contentid values of the uploaded html and asset files all files must be specified in the initial post call to the /sessions/ endpoint (step 1) you cannot use the put /sessions/{sessiontoken}/ or post /sessions/{sessiontoken}/uploads/ calls to dynamically add or remove files from the webpage upload session individual files these steps outline how to upload a single, independent file (such as a content file or plugin script) the client makes a post call to the /sessions/none/uploads/ endpoint with the following content type value application/vnd bsn start content upload arguments 201701+json the post request body includes information about the file the response body includes an upload token for the file the client uploads the file to the server by calling post on the /sessions/none/uploads/{uploadtoken}/chunks/ endpoint if the file is larger than approximately 256kb, the client will need to make multiple post calls and use the ?offset url parameter to segment the file into chunks the client completes the upload by calling put on the /sessions/none/uploads/{uploadtoken}/ endpoint with the following content type value application/vnd bsn complete content upload arguments 201701+json unlike other endpoints, the "/none/" directory is case sensitive and must be capitalized get / retrieves currently active webpage upload sessions parameters marker string a value specifying which page to retrieve this value is useful if the istruncated entry in the response body of the previous get call indicates that the number of webpageuploadstatus instances exceeds the pagesize filter string an filter expressions in the main api (2017/01) docid\ l8mfvfdghpy9xgiuquwcm for filtering search results pagesize int the maximum number of webpageuploadstatus instances that can be contained in the response body headers accept application/vnd bsn webpage upload status pagedlist 201701+json response bodies the paged list entity (2017/01) docid\ yn3gu asyfisjdxgbjdvb item webpageuploadstatus\[] an array of webpageuploadstatus object instances representing active webpage upload sessions each webpageuploadstatus instance can have the following entries name string the name of the webpage (i e the collection of files that make up the webpage) sessiontoken string a unique identifier for the webpage upload session uploadtoken string a unique identifier for the html file upload session contentid int a unique identifier for the content instance associated with the file being uploaded this value is 0 while the upload session is in progress filename string the name of the file being uploaded sha1hash string the sha1 hash value of the file contents state string the current state of the content upload session the possible state values are "unknown" , "queued" , "started" , "uploading" , "stopped" , "uploaded" , "verified" , "cancelled" , "corrupted" , "collected" , "terminated" , "completed" starttime string a utc timestamp indicating when the content upload session began the date/time is formatted as yyyy mm ddthh\ mm\ ss sssz endtime string a utc timestamp indicating when the content upload session ended the date/time is formatted as yyyy mm ddthh\ mm\ ss sssz lastactivitytime string a utc timestamp indicating the last activity relating to the content upload session the date/time is formatted as yyyy mm ddthh\ mm\ ss sssz chunks chunk\[] an array of chunk object instances representing chunks of the file each chunk instance can have the following entries count int the number of chunks with the specified length and state a zero value is used for the section of the file that has not been uploaded/queued yet length int the byte length of the chunk(s) state string the \[upload endpoints (2017/01)#state] of the chunk(s) assets webpageasset\[] an array of webpageasset object instances representing asset files that are part of the webpage the server currently returns a null value for this parameter post / creates a new webpage upload session for the webpage and its asset files this operation returns a token for the entire webpage upload session, as well as a token for each asset file upload headers content type application/vnd bsn start webpage upload arguments 201701+json or application/vnd bsn start webpage update arguments 201701+json accept application/vnd bsn webpage upload status 201701+json, application/vnd bsn error+json request body name string the name of the webpage (i e the collection of files that make up the webpage) filename string the name of the html file mediatype string the media type, which must be "webpage" for the html file filesize int the size of the html file (in bytes) sha1hash string the sha1 hash value of the file contents assets webpageasset\[] an array of webpageasset object instances representing asset files to upload as part of the webpage each webpageasset instance can have the following entries filename string the name of the asset file relativepath string the path of the asset file relative to the html file the path should be formatted as follows "\\\\\[directorya]\\\\\[directoryab]\\\\\[ ]" filesize int the size of the asset file (in bytes) mediatype string the media type of the asset file "auto" , "text" , "image" , "video" , "audio" , "webpage" , and "devicewebpage" types are accepted sha1hash string the sha1 hash value of the file contents response body name string the name of the webpage (i e the collection of files that make up the webpage) sessiontoken string the identifier for the webpage upload session filename string the name of the html file uploadtoken string a unique identifier for the html file upload session contentid int a unique identifier for the content instance associated with the file being uploaded this value is 0 while the upload session is in progress filesize int the size of the file (in bytes) sha1hash string the sha1 hash value of the file contents state string the current state of the html file upload session this value defaults to "started" in the post response starttime string a utc timestamp indicating when the content upload session began the date/time is formatted as yyyy mm ddthh\ mm\ ss sssz endtime string a utc timestamp indicating when the content upload session ended this value is null when the session is active lastactivitytime string a utc timestamp indicating the last activity relating to the content upload session the date/time is formatted as yyyy mm ddthh\ mm\ ss sssz chunks chunk\[] an array of chunk object instances representing chunks of the html/asset file each chunk instance can have the following entries count int the order of the chunk in the sequence length int the length (in bytes) of the chunk state string the \[upload endpoints (2017/01)#state] of the chunk assets webpageasset\[] an array of webpageasset object instances representing asset files to upload as part of the webpage get /{sessiontoken}/ returns the asset file upload sessions associated with the specifed webpage upload session headers accept application/vnd bsn webpage upload status 201701+json response body name string the name of the webpage (i e the collection of files that make up the webpage) sessiontoken string a unique identifier for the webpage upload session assets webpageasset\[] an array of webpageasset object instances representing asset files to upload as part of the webpage each webpageasset instance can have the following entries sessiontoken string the identifier for the webpage upload session filename string the name of the asset file uploadtoken string a unique identifier for the asset file upload session contentid int a unique identifier for the content instance associated with the file this value is 0 while the upload session is in progress filesize int the size of the file (in bytes) sha1hash string the sha1 hash value of the file contents state string the current \[upload endpoints (2017/01)#state] of the file upload session starttime string a utc timestamp indicating when the content upload session began the date/time is formatted as yyyy mm ddthh\ mm\ ss sssz endtime string a utc timestamp indicating when the content upload session ended this value is null when the session is active lastactivitytime string a utc timestamp indicating the last activity relating to the content upload session the date/time is formatted as yyyy mm ddthh\ mm\ ss sssz chunks chunk\[] an array of chunk object instances representing chunks of the html/asset file the server currently returns null for this parameter put /{sessiontoken}/ completes a webpage upload session headers content type application/vnd bsn complete webpage upload arguments 201701+json request body name string the name of the webpage (i e the collection of files that make up the webpage) filename string the name of the html file filesize int the size of the html file (in bytes) relativepath string the relative path of the html file the path should be formatted as follows "\\\\\[directorya]\\\\\[directoryab]\\\\\[ ]" for files in the same directory as the html file (or the html file itself), the path is specified as "\\\\" delete /{sessiontoken}/ terminates the specified webpage upload session the server returns code 204 on success get /{sessiontoken}/uploads/ returns currently active file uploads that are part of the specified webpage upload session (including both the html file and its asset files) calling get on the /sessions/none/uploads/ endpoint returns independent file uploads (i e uploads that are not part of a webpage upload session) parameters marker string a value specifying which page to retrieve this value is useful if the istruncated entry in the response body of the previous get call indicates that the number of webpageuploadstatus instances exceeds the pagesize filter string an filter expressions in the main api (2017/01) docid\ l8mfvfdghpy9xgiuquwcm for filtering search results pagesize int the maximum number of webpageuploadstatus instances that can be contained in the response body headers accept application/vnd bsn content upload status pagedlist 201701+json, application/vnd bsn error+json response body totalitemcount int the total number of webpageuploadstatus instances relevant to the query pagesize int the maximum number of webpageuploadstatus instances that can be returned in a single response istruncated bool a flag indicating whether the totalitemcount exceeds the pagesize nextmarker string a value that can be included with a subsequent get call to return additional results that have been truncated sortexpression string the sort expression specified in the url filterexpression string the filter expression specified in the url items contentuploadstatus\[] an array of content object instances representing html and asset file uploads that are part of the session each webpageuploadstatus instance can have the following entries sessiontoken string the identifier for the webpage upload session the value will be null for an independent file upload filename string the name of the file uploadtoken string a unique identifier for the file upload session contentid int a unique identifier for the content instance associated with the file this value is 0 while the upload session is in progress filesize int the size of the file (in bytes) sha1hash string the sha1 hash value of the file contents state string the current \[upload endpoints (2017/01)#state] of the file upload session starttime string a utc timestamp indicating when the content upload session began the date/time is formatted as yyyy mm ddthh\ mm\ ss sssz endtime string a utc timestamp indicating when the content upload session ended this value is null when the session is active lastactivitytime string a utc timestamp indicating the last activity relating to the content upload session the date/time is formatted as yyyy mm ddthh\ mm\ ss sssz chunks chunk\[] an array of chunk object instances representing chunks of the html/asset file the server currently returns null for this parameter post /{sessiontoken}/uploads/ begins a new file upload calling post on the /sessions/none/uploads/ endpoint begins an independent file upload get /{sessiontoken}/uploads/{uploadtoken}/ returns the specified active file upload that is part of the specified webpage upload session calling get on the /sessions/none/uploads/{uploadtoken}/ endpoint retrieves an independent file upload (i e an upload that is not part of a webpage upload session) headers accept application/vnd bsn content upload status 201701+json response body sessiontoken string the identifier for the webpage upload session the value will be null for an independent file upload filename string the name of the file uploadtoken string a unique identifier for the file upload session contentid int a unique identifier for the content instance associated with the file this value is 0 while the upload session is in progress filesize int the size of the file (in bytes) sha1hash string the sha1 hash value of the file contents state string the current \[upload endpoints (2017/01)#state] of the file upload session starttime string a utc timestamp indicating when the content upload session began the date/time is formatted as yyyy mm ddthh\ mm\ ss sssz endtime string a utc timestamp indicating when the content upload session ended this value is null when the session is active lastactivitytime string a utc timestamp indicating the last activity relating to the content upload session the date/time is formatted as yyyy mm ddthh\ mm\ ss sssz chunks chunk\[] an array of chunk object instances representing chunks of the file each chunk instance can have the following entries count int the number of chunks with the specified length and state a zero value is used for the section of the file that has not been uploaded/queued yet length int the byte length of the chunk(s) state string the \[upload endpoints (2017/01)#state] of the chunk(s) put /{sessiontoken}/uploads/{uploadtoken}/ starts, completes, or updates a file upload session (depending on the value of the content type header) calling put on the /sessions/none/uploads/{uploadtoken}/ endpoint modifies an independent file upload headers content type application/vnd bsn content upload arguments 201701+json or application/vnd bsn start content upload arguments 201701+json or application/vnd bsn complete content upload arguments 201701+json or application/vnd bsn content update arguments 201701+json or application/vnd bsn start content update arguments 201701+json or application/vnd bsn complete content update arguments 201701+json or application/vnd bsn webpage asset upload arguments 201701+json or application/vnd bsn start webpage asset upload arguments 201701+json or application/vnd bsn complete webpage asset upload arguments 201701+json accept application/vnd bsn content upload status 201701+json, application/vnd bsn content upload negotiation status 201701+json, application/vnd bsn error+json request body filename string the name of the file filesize int the size of the file (in bytes) relativepath string the relative path of the file the path should be formatted as follows "\\\\\[directorya]\\\\\[directoryab]\\\\\[ ]" for files in the same directory as the html file (or the html file itself), the path is specified as "\\\\" delete /{sessiontoken}/uploads/{uploadtoken}/ terminates the specified upload that is part of the specified webpage upload session calling delete on the /sessions/none/uploads/{uploadtoken}/ endpoint terminates an independent file upload the server returns code 204 on success get /{sessiontoken}/uploads/{uploadtoken}/chunks/ returns the status of all file chunks that are part of the file specified file upload headers accept application/vnd bsn upload content chunk status list 201701+json response body chunks chunk\[] an array of chunk object instances representing chunks of the file each chunk instance can have the following entries count int the number of chunks with the specified length and state a zero value is used for the section of the file that has not been uploaded/queued yet length int the byte length of the chunk(s) state string the \[upload endpoints (2017/01)#state] of the chunk(s) post /{sessiontoken}/uploads/{uploadtoken}/chunks/ appends a file chunk to the file upload, placing it in the queue for assembly the server returns code 202 upon completion file chunks don't have to be uploaded in order, and multiple chunks can be uploaded simultaneously we recommend a default chunk size of 256kb for multi chunk files, though this number can be flexible depending on network performance parameter offset the offset of the file chunk (in bytes) from the beginning of the file headers accept application/vnd bsn error+json content type application/octet stream content length \[filechunklength] request body the request body should contain the file chunk as binary data