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

Make REST API endpoints consume and produce 'application/json' as content type

    XMLWordPrintable

    Details

    • Type: Task
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 10.3
    • Component/s: Rest API
    • Impact type:
      API change
    • Upgrade notes:
      Hide

      The REST API now produces and consumes only application/json as content type:

      • application/json+nxentity is now never returned as content type response; the server does not expect it as content type request.
      • application/json+nxrequest content type should not be used anymore. It still works but it's deprecated server side. application/json should be used instead when POSTing to automation.
      • application/json+esentity which was never used was also removed.

      Breaking change:

      • the org.nuxeo.ecm.automation.jaxrs.io.documents.JsonESDocumentWriter, located in nuxeo-automation-io has moved to org.nuxeo.elasticsearch.io.JsonESDocumentWriter, located in nuxeo-elasticsearch-core. The JsonESDocumentWriter does not implement anymore MessageBodyWriter<DocumentModel>, you may need to update your code.
      Show
      The REST API now produces and consumes only application/json as content type: application/json+nxentity is now never returned as content type response; the server does not expect it as content type request. application/json+nxrequest content type should not be used anymore. It still works but it's deprecated server side. application/json should be used instead when POSTing to automation. application/json+esentity which was never used was also removed. Breaking change: the org.nuxeo.ecm.automation.jaxrs.io.documents.JsonESDocumentWriter , located in nuxeo-automation-io has moved to org.nuxeo.elasticsearch.io.JsonESDocumentWriter , located in nuxeo-elasticsearch-core . The JsonESDocumentWriter does not implement anymore MessageBodyWriter<DocumentModel> , you may need to update your code.
    • Sprint:
      nxfit 10.3.6, nxfit 10.3.7, nxfit 10.3.8
    • Story Points:
      3

      Description

      Currently, there is a mix of returned content types between application/json, application/json+nxentity and application/json+esentity.

      As there is one content type returned, it should always be the standard application/json.
      => application/json must be the first one in the @Produces annotation.

      Not returning the standard one breaks some functionality such as the JSON rendering in browsers (they download a file instead of displaying the JSON).

      Moreover, there is the application/json+nxrequest content type which is used only when POSTing on the automation endpoint. As the endpoint also accepts raw application/json there is no need for that one. We can't just remove it as old code (such has clients, drive, ...) so it will be deprecated.

      Finally, application/json+esentity is never used and not useful, it will be removed and the JsonESDocumentWriter will be moved to nuxeo-platform-elasticsearch-core module as it does not belong to nuxeo-automation-io.

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                1 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - 0 minutes
                  0m
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 1 day, 5 hours
                  1d 5h