Uploaded image for project: 'Webservices REST Module'
  1. Webservices REST Module
  2. RESTWS-523

Add Rest Endpoint for Form Resource

    XMLWordPrintable

    Details

    • Type: New Feature
    • Status: Closed
    • Priority: Could
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.12
    • Labels:
      None
    • Complexity:
      Medium

      Description

      Context
      We currently working to create forms using angular formly to be used in an angular application which rely entirely on OpenMRS rest web service. This involves creation of form schemas which are basically json files. We want to be able to create these files and post them and of course retrieve them when needed. Ideally these will be stored in OpenMRS as form_resource or clob_datatype_storage.

      Acceptance Criteria
      Being able to post and retrieve form resources as per example URLs below
      1. Getting a list of resources associated with a form

      GET /ws/rest/v1/formresource?form={uuid}
      

      2. Getting a specific form resource. This will return among other things the reference to the actual resource data stored in clob_datatype_storage table.

      GET /ws/rest/v1/formresource/{uuid}
      

      3. Getting the actual data. This will return file data in body (Json won't be appropriate in this case)
      Note uuid will be fetched from the results of the call made in 1 or 2 above.

      GET /ws/rest/v1/clobdata/{uuid}
      

      Notice that getting form resource will involve two stages due to the way things are setup in OpenMRS. However may be we could think of a way to reduce it to one call

      4. Posting a form resouce
      This will involve two stages.
      step 1: Posting resource first as file (multipart/form-data content type in http header). This will return the uuid of a newly created clob datatype.

      POST /ws/rest/v1/clobdata
      [body]
      file data
      [/body]
      

      step 2: Posting metadata associated with the data posted in step 1 above using the uuid returned as a reference.

      POST /ws/rest/v1/formresource
      [body]
      json metadata
      [/body]
      

      5. Purging & updating existing form resource.

        Attachments

          Activity

            People

            Assignee:
            willa Willa Mhawila [X] (Inactive)
            Reporter:
            willa Willa Mhawila [X] (Inactive)
            Votes:
            2 Vote for this issue
            Watchers:
            9 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: