872: Fix search endpoints to use query parameters

 

Test Case #:872

 

Test Case Name: Fix search endpoints to use query parameters

System: OpenLMIS

Subsystem:requisition

Test case designed by: Lucyna Kwidzińska

Design Date:16.08.2016

Short description:

We currently have got several search endpoints, that go against the OpenLMIS v3 style guide and use specific paths for every parameter search, instead of query parameters. We should find all of those endpoints and refactor them to accept query parameters (take into consideration that some parameters may be required and some not).

 

                                                                                                                                                   

Pre – conditions:

                                                                                                                                                                                                                                                       

 

 

Step

Action

Expected system response

Comment

1Request a token from authentication service with some rest client:

Token has been generated.

Copy the token from response (e.g. {"access_token":"121d02ed-b6b4-4233-9566-cac2b8a3aec9"...).

2

          Search Order by parameters:           

  /orders/search?supplyingFacility=x&requestingFacility=x&program=x

parameters:

  • supplyingFacility - required
  • requestingFacility - not required
  • program - not required

  example URL: 

http://localhost:8080/api/orders/search?supplyingFacility=1db0dc38-b34b-4e9c-b4d8-5c3a4c79e8e0&requestingFacility=1db0dc38-b34b-4e9c-b4d8-5c3a4c79e8e0&program=d0eda21d-a679-463b-9fc3-c33a20568d7f&access_token=4d7b5e96-4674-44ea-a5f8-257fb48ea892

Method: GET

  Searching the order is possible.          

                                                

3

Verify if searching the Order will be possible without required parameter (supplyingFacility).

example URL: http://localhost:8080/api/orders/search?requestingFacility=1db0dc38-b34b-4e9c-b4d8-5c3a4c79e8e0&program=d0eda21d-a679-463b-9fc3-c33a20568d7f&access_token=c66a89b9-ed30-4695-9fe8-b30e085a0bea

Method: GET

 

  Searching the order is not possible without required paramater.

 

4

Search User by parameters:
/users/search?username=x&firstName=x&lastName=x&homeFacility=x&active=x&verified=x


parameters:

  • username - not required
  • firstName - not required
  • lastName - not required
  • homeFacility - not required
  • active - not required
  • verified - not required

 

example URL: http://localhost:8080/api/users/search?username=user1&firstName=user&lastName=testuser&homeFacility=1db0dc38-b34b-4e9c-b4d8-5c3a4c79e8e0&active=true&verified=true&access_token=83b5f01a-db20-420e-9e38-efc9ed8a2849

Method: GET

  Searching the user is possible.

 

5

Search ProductCategory by parameters:
/productCategories/search?code=x


parameters:

  • code - not required

example URL: http://localhost:8080/api/productCategories/search?code=code1&access_token=83b5f01a-db20-420e-9e38-efc9ed8a2849

Method: GET

  Searching the productCategory is possible.

 

6

Search Period by parameters:
/periods/search?processingSchedule=x&startDate=x


parameters:

  • processingSchedule - required
  • toDate - not required

example URL: http://localhost:8080/api/periods/search?processingSchedule=a6d29053-b5f2-43d9-be0d-5b76eb1fd199&toDate=2016-08-18&access_token=83b5f01a-db20-420e-9e38-efc9ed8a2849

Method: GET

  Searching the period is possible.

 

7

Verify if searching the Period will be possible without required parameter (processingSchedule).

example URL: http://localhost:8080/api/periods/search?toDate=2016-08-18&access_token=83b5f01a-db20-420e-9e38-efc9ed8a2849

Method: GET

  Searching the period is not possible withour required parameter.

 

8

Search ProgramProduct by parameters:
/programProducts/search?program=x&fullSupply=x


parameters:

  • program - required
  • fullSupply - not required

example URL: http://localhost:8080/api/programProducts/search?program=d0eda21d-a679-463b-9fc3-c33a20568d7f&fullSupply=true&access_token=83b5f01a-db20-420e-9e38-efc9ed8a2849

Method: GET

  Searching the programProduct is possible.

 
9

Verify if searching the programProduct will be possible without required parameter (program).

 

example URL: http://localhost:8080/api/programProducts/search?fullSupply=true&access_token=83b5f01a-db20-420e-9e38-efc9ed8a2849

Method: GET

  Searching the programProduct is not possible without required parameter.

 

10

Search Stock by parameters:
/stocks/search?stockInventory=x&product=x


parameters:

  • Product - not required

example URL: http://localhost:8080/api/stocks/search?product=017a7bc6-70f9-4b3f-be38-f0f8267adf24&access_token=83b5f01a-db20-420e-9e38-efc9ed8a2849

Method: GET

  Searching the stock is possible.

 

11

Search SupplyLine by parameters:
/supplyLines/search?program=x&supervisoryNode=x


parameters:

  • program - required
  • supervisoryNode - required

 

example URL: http://localhost:8080/api/supplyLines/search?program=d0eda21d-a679-463b-9fc3-c33a20568d7f&supervisoryNode=c91d6c28-2037-4968-a7b7-13a1688d86c0&access_token=83b5f01a-db20-420e-9e38-efc9ed8a2849

method: GET

  Searching the supplyLine is possible.

 

12

Verify if searching the supplyLine will be possible without one of the required parameters (program or supervisoryNode).

example URL: http://localhost:8080/api/supplyLines/search?program=d0eda21d-a679-463b-9fc3-c33a20568d7f&access_token=c66a89b9-ed30-4695-9fe8-b30e085a0bea

Method: GET

  Searching the supplyLine is not possible without required parameter.

 

13

Search RequisitionLine by parameters:
/requisitionLines/search?requisition=x&product=x


parameters:

  • requisition - required
  • product - required

example URL: http://localhost:8080/api/requisitionLines/search?product=bcbcc201-cf2b-4edb-856b-706c3e70dfa0&requisition=8120b823-9847-4432-94c0-bc183bc036e5&access_token=4d7b5e96-4674-44ea-a5f8-257fb48ea892

Method: GET

  Searching the requisitionLine is possible.

 

14

Verify if searching the requisitionLine will be possible without one of the required parameters (requisition or product).

example URL: http://localhost:8080/api/requisitionLines/search?product=bcbcc201-cf2b-4edb-856b-706c3e70dfa0&access_token=c66a89b9-ed30-4695-9fe8-b30e085a0bea

Method: GET

 

  Searching the requisitionLine is not possible without required parameter.

 
15

Search Requisition by parameters:
/requisitions/search?facility=x&program=x&status=x&supervisoryNode=x&processingPeriod=x


parameters:

  • requisition - not required,
  • program - not required,
  • createdDateFrom - not required,
  • createdDateTo - not required,
  • processingPeriod - not required,
  • requisitionStatus - not required,
  • supervisoryNode - not required

example URL:

http://localhost:8080/api/requisitions/search?facility=1db0dc38-b34b-4e9c-b4d8-5c3a4c79e8e0&programs=d0eda21d-a679-463b-9fc3-c33a20568d7f&createdDateFrom=2016-08-12T07:36:33.885&createdDateTo=2016-08-17T07:36:33.885&processingPeriod=a6d29053-b5f2-43d9-be0d-5b76eb1fd199&requisitionStatus=SUBMITTED&supervisoryNode=c91d6c28-2037-4968-a7b7-13a1688d86c0&access_token=4d7b5e96-4674-44ea-a5f8-257fb48ea892

Method: GET

 Searching the requisition is possible.

 

 

16

Search RequisitionTemplate by parameters:
/requisitions/search?program=x


parameters:

  • program - not required

example URL: http://localhost:8080/api/requisitionTemplates/search?program=d0eda21d-a679-463b-9fc3-c33a20568d7f&access_token=4d7b5e96-4674-44ea-a5f8-257fb48ea892

method: GET

Searching the requisitionTemplate is possible.

 

 

 

Post – conditions:

OpenLMIS: the global initiative for powerful LMIS software