1

Web Page Upload REST API

According to documentation every webpage collection needs a name.I am providing name for webpage collection and getting the name in the POST response from /sessions/ endpoint  but it doesn’t stored on the server because when I access the BrightSign REST API with GET request to /sessions/  using my current session_id it shows all records except from “name" field which is empty. I don't know where I am getting wrong. 

12 comments

  • 0
    Avatar
    Lyndon

     

    Is this still an open issue?

  • 0
    Avatar
    Jon Bloom

    We are experiencing the same issue. We have the content uploading properly, but when we go to complete the upload session, we get back a extremely detailed "{'message': 'An error has occurred.'}" with a status code of 500. 

  • 0
    Avatar
    Alex

    Hi Jon,

    Where did you create a network - on brightsignnetwork.com or bsn.cloud ?

  • 0
    Avatar
    Jon Bloom

    Alex,

    This is specifically about the BSN REST API. When following the steps outlined in the beginning of this article (https://docs.brightsign.biz/display/DOC/Upload+Endpoints), we have everything working properly, except the last step to close out the upload session. We are attempting to integrate the BSN REST API into our automated GitLab CI/CD process to automate the uploading of our HTML sites into BSN when a release is approved.

    When we make a PUT request to /sessions/{sessionToken}/ with the specified header, we just get back that 500 error saying "An error has occurred", with no indication of what that error actually is, or what is causing it. All other upload calls previous to this one have been successful, at least according to the API responses. Like the original posted said, when calling GET on /sessions/, the upload session doesn't show the name property specified in the initial session creation. Perhaps that's not being saved properly in the BSN backend thus having an invalid object to save to the database?

  • 1
    Avatar
    Jon Bloom

    Hi Alex,

    It's been a month since I've reached out and I've received no response. Do you have an update for me?

  • 1
    Avatar
    Jon Bloom

    Hi Alex,

     

    It's been two more weeks and still nothing from the BrightSign team. Any updates on this?

  • 0
    Avatar
    Alex

    Hi Jon,

    Sorry for delay. We have two different environments: "BSN Classic" and "BSN.cloud". Which one of these do you use?

    If you use the new "BSN.cloud" environment, you can go to https://bsn.cloud  and upload a web page to the Network from your web browser. During the upload, open web browser dev tools > Network tab and inspect what requests it sends to API.

    Or you can look at bsn-cloud-core on public Github: https://github.com/brightsign/bsn-cloud-core

    In the examples directory, there is already a working Typescript example to upload content files to BSN. There are also examples of creating presentations, though there is not currently an example of creating a presentation with a web page (it will be added later).

     

    If you use the old "BSN Classic" environment, I don't have an example of web page upload. I can ask our developers and get back to you. This may take some time.

  • 1
    Avatar
    Jon Bloom

    I thought it was pretty clear that we were using "BSN Classic", I linked to the exact API documentation page I was following, and specified the exact call we're using.

    The specific question is around completing the upload session. When making the PUT request to finish it out, we just get an error that says "An error has occurred" which tells us absolutely nothing about *what* the error is.

  • 0
    Avatar
    Alex

    Please check the attached example of a successful web page upload:

    https://brightsigninfo-my.sharepoint.com/:u:/g/personal/akurbyuk_brightsign_biz/EfKB2sOJ9tJAgDQuMla4VUkBdZU3fVW104zE9fI39P5c7Q?e=Vu6Tkx

    This zip file has a collection of API requests to our QA server (you will need to use https://api.brightsignnetwork.com/upload/2017/01/REST/....) and the webpage that was uploaded. 

    The web page has an index file and one asset file named 'number1.jpg'.

    The upload API calls start with the POST call on line 27 - this is the POST to get a session token for the webPage upload session. The PUT call you are having trouble with is, in this example, the final Session PUT call on line 107. Pay particular attention to the layout of the properties in the Request body for that call (line 108).
    The JSON lines in this log are all valid JSON - you can put them in many development editors (e.g., Sublime, VSCode,) and then use a JSON formatting function to make them more readable.
     
    The actual chunk calls are not shown, as they contain large blocks of binary data.
     
    Hope this helps.
  • 1
    Avatar
    Jon Bloom

    Thanks. Your logs clued me in to what our problem was -- we weren't including the full asset list in the PUT to close out the upload session. You'll notice that the documentation does not specify that including the asset list is required in the request body. 

    We were pulling out hair out for a long time on this one. Please update the docs so nobody else has struggle with this the same way we did. Screenshot below for your of the current state

  • 1
    Avatar
    Jon Bloom

    Alex,

    Is it not possible to upload a Webpage  to overwrite an existing one? I know when manually uploading in BrightAuthor it asks if you want to overwrite, but the API is just returning a "A WebPage with the specified name already exists." The whole point of this exercise was to automate content updates when we release new versions, but if we can't overwrite existing content in BSN, then that doesn't work.

    Are there additional steps required to allow overwriting an existing WebPage?

     

  • 0
    Avatar
    Alex

    Please use https://github.com/brightsign/bsn-cloud-core 

    It has uploadWebSiteToBsn.js example (in "examples" folder)

    You can run it from node.js:

     > node examples/uploadWebSiteToBsn.js

    The webpage itself is in \examples\testMedia\htmlSites folder.

    In the example, the webpage with the same name will be overwritten. 

     

     

Please sign in to leave a comment.