returnStatus example for creating a responder using the REST API

jefftuckerbofajefftuckerbofa Posts: 83

I have a process that creates message responders using the REST API. To date, I have always used the default values for the returnStatus portion of the request. All of my users have only needed an HTTP 200 response. Now I have a new request to allow custom return status codes, e.g. 201 Created, or 401 Unauthorized, etc.

Can you give me an example of how I would use those values in the request JSON for /tools/messageResponders POST?

Thanks,

JT

Comments

  • williammccuskerwilliammccusker Posts: 484 ✭✭✭

    Hi,

    I would recommend taking a look at the REST API page on the server, it should have a default structure that shows all the available fields.

    It can be found at http://:/soavirt/api

    This is the relevant field and its children that you are looking for. The field "options" I believe is a child of the root object. There are two parts, the message and the status code. Depending on how your server is deployed the message may or may not be supported but the status code always works every where.

    Let me know if this helped!

    "options": {
        "returnStatus": {
          "useDefault": false,
          "message": {
            "type": "fixed",
            "fixed": "HTTP MESSAGE"
          },
          "status": {
            "type": "fixed",
            "fixed": "401"
          }
        }
    }
    
  • jefftuckerbofajefftuckerbofa Posts: 83

    Thanks, I saw this in the API docs, but I wasn't exactly sure how the values fit. What you have posted makes perfect sense. Thanks once again for making me look good here at the bank. ;-) JT

  • williammccuskerwilliammccusker Posts: 484 ✭✭✭

    Happy to help! :smile:

Sign In or Register to comment.