Testing REST URI's

i want to get encounter in REST using uri through patient id or location id.

So far i have tried :

/openmrs/ws/rest/v1/encounter?patient = 656 /openmrs/ws/rest/v1/encounter?patient = {patient name}

Though i can get encounter by its uuid but i want to get through patient id.

Thanks

As far as i know, this supports a string uuid instead of the integer patientId. Do you have a reason for not using uuid? http://uat02.openmrs.org:8080/openmrs/module/webservices/rest/apiDocs.htm#!/encounter/getAllEncounters

1 Like

Got now. Can you please tell me how what will be the URI for checking program

Are you looking for this? http://uat02.openmrs.org:8080/openmrs/module/webservices/rest/apiDocs.htm#/program

Actually i want to add program for patient using REST

I believe the resource is called β€œprogramenrollment”.

-Darius (by phone)

yes. can you please help me that how to do this using rest.

Did you see this? http://uat02.openmrs.org:8080/openmrs/module/webservices/rest/apiDocs.htm#!/programenrollment/createProgramEnrollment

We tried out Postman’s Neuman when working with @maany on testing Platform 2.0. With Docker installed, collections of REST tests can be shared via GitHub.

For example, assuming you have Docker installed,

$ docker --version ;# confirm docker is installed
Docker version 1.12.3, build 6b644ec

Then, you can run a collection of tests against the platform within a single command line:

$ docker run --rm -it postman/newman_alpine33 run "https://raw.githubusercontent.com/bmamlin/openmrs-contrib-postman-collections/master/platform-2.0-tests.postman_collection"
newman

platform-2.0-tests

β†’ http://uat-platform.openmrs.org:8080/openmrs/ws/rest/v1/concept
  POST http://uat-platform.openmrs.org:8080/openmrs/ws/rest/v1/concept [201 Created, 2.16KB, 3.3s]
  βœ“  name.name == 'Nose Hair Density'
  βœ“  datatype.uuid == '8d4a4488-c2cc-11de-8d13-0010c6dffd0f' (Numeric)

β†’ http://uat-platform.openmrs.org:8080/openmrs/ws/rest/v1/concept?q=nose%20hair%20density&v=full
  GET http://uat-platform.openmrs.org:8080/openmrs/ws/rest/v1/concept?q=nose%20hair%20density&v=full [200 OK, 3.76KB, 273ms]
  βœ“  Found UUID for new concept
  βœ“  Concept is not retired

β†’ http://uat-platform.openmrs.org:8080/openmrs/ws/rest/v1/concept/{{NoseHairDensityUuid}}
  DELETE http://uat-platform.openmrs.org:8080/openmrs/ws/rest/v1/concept/5c3d08a5-4710-4a5a-a9ce-355e31c66fcb [204 No Content, 2.02KB, 517ms]
  βœ“  Status code is 204

β†’ http://uat-platform.openmrs.org:8080/openmrs/ws/rest/v1/concept/{{NoseHairDensityUuid}}
  GET http://uat-platform.openmrs.org:8080/openmrs/ws/rest/v1/concept/5c3d08a5-4710-4a5a-a9ce-355e31c66fcb [200 OK, 2.12KB, 74ms]
  βœ“  Correct UUID
  βœ“  Concept is retired

β†’ http://uat-platform.openmrs.org:8080/openmrs/ws/rest/v1/concept/{{NoseHairDensity.uuid}}?purge=true
  DELETE http://uat-platform.openmrs.org:8080/openmrs/ws/rest/v1/concept/5c3d08a5-4710-4a5a-a9ce-355e31c66fcb?purge=true [204 No Content, 2.02KB, 350ms]
  βœ“  Status code is 204

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                         β”‚ executed β”‚   failed β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚              iterations β”‚        1 β”‚        0 β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚                requests β”‚        5 β”‚        0 β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚            test-scripts β”‚        5 β”‚        0 β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚      prerequest-scripts β”‚        0 β”‚        0 β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚              assertions β”‚        8 β”‚        0 β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ total run duration: 5.9s                      β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ total data received: 7.43KB (approx)          β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ average response time: 902ms                  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

These collections can be created, exported, and imported using Postman.

1 Like

@burke this is amazing! I can help set the cogs moving in the direction of building a test suite after my finals :smiley: