make.comintegromat-apps

Creating RPC through intergromat apps returns 404


I am trying to create an RPC that lists departments in a service. However, the endpoint for listing all departments returns an HTTP 404 error if no departments exist. It seems that the 'valid' directive does not work when the status code is greater than 399. Is there a workaround for this?


Solution

  • There is no way to mark a response status greater than 399 as OK. The valid directive serves for the other direction - marking a 200 status as an error. The only thing I can recommend is putting the following error handling code inside your RPC:

    "error": {
      "404": {
        "type": "DataError",
        "message": "No departments found. --ServiceName-- marks this case as an error - please switch to the Map mode to save."
      }
    }
    

    That will at least help the user know what's going on when they try to set up the module input.

    Here's what this would look like inside a Scenario.