Uploaded image for project: 'Nuxeo Platform'
  1. Nuxeo Platform
  2. NXP-32726

Return 400 status code for incorrect entity-type

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Blocker
    • Resolution: Fixed
    • Affects Version/s: 2021.55, 2023.13
    • Fix Version/s: 2025.x, 2021.57, 2023.15
    • Component/s: Rest API
    • Release Notes Summary:
      Workflow requests with wrong workflow name or entity type return 404 and 400 codes.
    • Backlog priority:
      800
    • Sprint:
      nxplatform #117
    • Story Points:
      5

      Description

      When a user supplies an incorrect entity-type in an API request, a 500 error code is returned. I believe a 400 error would be more appropriate
      Example Request

      curl -u <user>:<pass> -X POST <SERVER_URL>/nuxeo/api/v1/id/<doc_id>/@workflow \
      -H 'Content-type:application/json' \
      -d '{"entity-type":"testing","workflowModelName":"ParallelDocumentReview","attachedDocumentIds":["documentIds"]}'
      

      Response is

      {"entity-type":"exception","status":500,"message":"Internal Server Error"}
      

      Actual error in logs is

      org.nuxeo.ecm.core.io.registry.MarshallingException: Json object entity-type is wrong. Expected is workflow but was testing
      

       

      The same applies for incorrect workflowModelName. It returns a 500 error but could be 400 or 404. Ex

      curl -u <user>:<pass> -X POST https://nightly-2021.nuxeocloud.com/nuxeo/api/v1/id/43a1955b-314c-4a9d-877d-a4ed6681ce19/@workflow \
      -H 'Content-type:application/json' \
      -d '{"entity-type":"workflow","workflowModelName":"TestWorkflow","attachedDocumentIds":["43a1955b-314c-4a9d-877d-a4ed6681ce19"]}'
      

      Error from logs is

      org.nuxeo.ecm.core.api.NuxeoException: No route found for id: TestWorkflow
      

      Nuxeo returns a 500 error but believe 400 or 404 would be more appropriate.

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: