├── .github └── workflows │ └── build_docs.yml ├── .gitignore ├── CODE_OF_CONDUCT.md ├── LICENSE ├── README.md └── source ├── images └── logo.png ├── includes ├── AddressTemplate │ └── address_template.md ├── AdministrationLinks │ └── administration_links.md ├── Alerts │ └── alerts.md ├── Concepts │ ├── concept.md │ ├── concept_attribute_type.md │ ├── concept_data_type.md │ ├── concept_map_type.md │ ├── concept_proposal.md │ ├── concept_reference_term_type.md │ ├── concept_source.md │ ├── concept_stop_word.md │ └── concepts_class.md ├── DatabaseChanges │ └── database_changes.md ├── Drugs │ └── drugs.md ├── EmrApi │ ├── emrapi_configuration.md │ ├── inpatient_admission.md │ └── inpatient_request.md ├── Encounter │ ├── encounter.md │ ├── encounter_role.md │ └── encounter_type.md ├── Forms │ ├── Forms.md │ └── field_type.md ├── ImplementationId │ └── implementation_id.md ├── LocaleAndTheme │ └── locale_and_theme_configuration.md ├── Location │ ├── location.md │ ├── location_attribute_type.md │ └── location_tag.md ├── Observations │ └── obs.md ├── Orders │ ├── order.md │ └── order_type.md ├── Patient │ ├── auto_generation_options.md │ ├── patient_identifier_log_entry.md │ ├── patient_identifier_source.md │ ├── patient_identifier_type.md │ └── patients.md ├── Person │ ├── person_attribute_type.md │ └── persons.md ├── Programs │ ├── concept_state_conversions.md │ ├── program_enrollment.md │ ├── program_workflows.md │ └── programs.md ├── Provider │ ├── provider.md │ └── provider_attribute_type.md ├── Queue │ ├── queue.md │ └── queue_room.md ├── Relationships │ └── relationship_type.md ├── SearchIndex │ └── search_index.md ├── SystemInformation │ ├── loggedin_users.md │ └── system_information.md ├── SystemSettings │ └── system_settings.md ├── Tasks │ └── tasks.md ├── User │ ├── privileges.md │ ├── role.md │ └── user.md ├── Visit │ ├── visit_attribute_type.md │ ├── visit_type.md │ ├── visits.md │ └── visits_configuration.md ├── auth.md ├── contrib.md └── info.md └── index.html.md /.github/workflows/build_docs.yml: -------------------------------------------------------------------------------- 1 | name: REST API Docs 2 | 3 | on: 4 | push: 5 | workflow_dispatch: 6 | 7 | jobs: 8 | slate-documentation: 9 | runs-on: ubuntu-latest 10 | steps: 11 | - uses: actions/checkout@v2 12 | - name: Build documentation 13 | run: docker run --rm --name slate -v $(pwd)/build:/srv/slate/build -v $(pwd)/source/index.html.md:/srv/slate/source/index.html.md -v $(pwd)/source/includes:/srv/slate/source/includes -v $(pwd)/source/images/logo.png:/srv/slate/source/images/logo.png slatedocs/slate 14 | - name: Deploy documentation 15 | if: ${{ (github.event_name == 'push' || github.event_name == 'workflow_dispatch') && github.ref == 'refs/heads/master' }} 16 | uses: JamesIves/github-pages-deploy-action@4.1.4 17 | with: 18 | branch: gh-pages 19 | folder: build -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.rbc 2 | .bundle 3 | .config 4 | coverage 5 | InstalledFiles 6 | lib/bundler/man 7 | pkg 8 | rdoc 9 | spec/reports 10 | test/tmp 11 | test/version_tmp 12 | tmp 13 | *.DS_STORE 14 | build/ 15 | .cache 16 | .vagrant 17 | .sass-cache 18 | *.iml 19 | 20 | # YARD artifacts 21 | .yardoc 22 | _yardoc 23 | doc/ 24 | .idea/ 25 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation. 6 | 7 | ## Our Standards 8 | 9 | Examples of behavior that contributes to creating a positive environment include: 10 | 11 | * Using welcoming and inclusive language 12 | * Being respectful of differing viewpoints and experiences 13 | * Gracefully accepting constructive criticism 14 | * Focusing on what is best for the community 15 | * Showing empathy towards other community members 16 | 17 | Examples of unacceptable behavior by participants include: 18 | 19 | * The use of sexualized language or imagery and unwelcome sexual attention or advances 20 | * Trolling, insulting/derogatory comments, and personal or political attacks 21 | * Public or private harassment 22 | * Publishing others' private information, such as a physical or electronic address, without explicit permission 23 | * Other conduct which could reasonably be considered inappropriate in a professional setting 24 | 25 | ## Our Responsibilities 26 | 27 | Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior. 28 | 29 | Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. 30 | 31 | ## Scope 32 | 33 | This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers. 34 | 35 | ## Enforcement 36 | 37 | Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at hello@lord.io. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. 38 | 39 | Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. 40 | 41 | ## Attribution 42 | 43 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version] 44 | 45 | [homepage]: http://contributor-covenant.org 46 | [version]: http://contributor-covenant.org/version/1/4/ 47 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # openmrs-contrib-rest-api-docs 2 | 3 | This is the repository for OpenMRS REST API documentation. 4 | 5 | The live documentation site can be viewed at [rest.openmrs.org](https://rest.openmrs.org/). 6 | 7 | ## Contributing to the documentation 8 | 9 | OpenMRS documentation is built using [Slate](https://github.com/slatedocs/slate). 10 | All documentation can be found in the `source/includes/` directory and uses 11 | [Markdown](https://guides.github.com/features/mastering-markdown/) text format. 12 | 13 | Contributions are welcome! 14 | 15 | ## Get Started 16 | 17 | Fork this repository in Github and submit the changes via pull requests. If 18 | you browse to the markdown files in this repository and edit them, GitHub will 19 | guide you through forking and making a pull request with your suggested changes. 20 | 21 | ### Build the REST API Documentation locally 22 | 23 | Use Git to clone the repository and use Docker to build and serve it (requires pre-installed git and docker). 24 | 25 | 1. Clone the openmrs-contrib-rest-api-docs repository: 26 | ``` 27 | git clone https://github.com/openmrs/openmrs-contrib-rest-api-docs.git 28 | ``` 29 | 2. Start the server 30 | ``` 31 | docker run --rm --name slate \ 32 | -v "$(pwd)/build:/srv/slate/build" \ 33 | -v "$(pwd)/source/index.html.md:/srv/slate/source/index.html.md" \ 34 | -v "$(pwd)/source/includes:/srv/slate/source/includes" \ 35 | -v "$(pwd)/source/images/logo.png:/srv/slate/source/images/logo.png" \ 36 | -p 4567:4567 slatedocs/slate serve 37 | ``` 38 | 39 | Browse to http://localhost:4567/ and you should see the docs! 40 | 41 | ### Guide for new PR's 42 | 43 | 1. Make sure you add the document inside under the `source/includes/` folder 44 | inside the relevant subfolder. 45 | 46 | 2. Make sure to follow conventions used in existing markdown files for consistency. 47 | 48 | 3. New files need to be added to the list of inclusions in 49 | [`source/includes/info.md`](source/includes/info.md). 50 | -------------------------------------------------------------------------------- /source/images/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openmrs/openmrs-contrib-rest-api-docs/8d84cb58be0edf75aaf52af63532396c5a93fb44/source/images/logo.png -------------------------------------------------------------------------------- /source/includes/AddressTemplate/address_template.md: -------------------------------------------------------------------------------- 1 | # Address Template 2 | 3 | ## Address Template Overview 4 | 5 | Address Template is an XML Layout Template. 6 | 7 | ## Available operations for Address Template 8 | 9 | 1. [Retrieve Address Template](#retrieve-address-template) 10 | 2. [Update Address Template](#update-address-template) 11 | 12 | ## Retrieve Address Template 13 | 14 | > Retrieve Address Template 15 | 16 | ```shell 17 | GET /systemsetting/layout.address.format 18 | ``` 19 | 20 | ```java 21 | OkHttpClient client = new OkHttpClient().newBuilder() 22 | .build(); 23 | Request request = new Request.Builder() 24 | .url("/openmrs/ws/rest/v1/systemsetting/layout.address.format") 25 | .method("GET", null) 26 | .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=") 27 | .addHeader("Cookie", "JSESSIONID=1B06650EB0428F51EC119C909F58327C") 28 | .build(); 29 | Response response = client.newCall(request).execute(); 30 | ``` 31 | 32 | 33 | ```javascript 34 | var requestHeaders = new Headers(); 35 | requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM="); 36 | requestHeaders.append("Cookie", "JSESSIONID=1B06650EB0428F51EC119C909F58327C"); 37 | var requestOptions = { 38 | method: 'GET', 39 | headers: requestHeaders, 40 | redirect: 'follow' 41 | }; 42 | fetch("/openmrs/ws/rest/v1/systemsetting/layout.address.format", requestOptions) 43 | .then(response => response.text()) 44 | .then(result => console.log(result)) 45 | .catch(error => console.log('error', error)); 46 | ``` 47 | 48 | > Success Response 49 | 50 | ```response 51 | { 52 | "uuid": "98fa7af1-d183-4f70-93fb-2f488000ce4c", 53 | "property": "layout.address.format", 54 | "value": "\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n address1\n address2\n cityVillage stateProvince country postalCode\n \n ", 55 | "description": null, 56 | "display": "Layout - Address Format = \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n address1\n address2\n cityVillage stateProvince country postalCode\n \n ", 57 | "links": [ 58 | { 59 | "rel": "self", 60 | "uri": "http://localhost:8080/openmrs/ws/rest/v1/systemsetting/98fa7af1-d183-4f70-93fb-2f488000ce4c", 61 | "resourceAlias": "systemsetting" 62 | }, 63 | { 64 | "rel": "full", 65 | "uri": "http://localhost:8080/openmrs/ws/rest/v1/systemsetting/98fa7af1-d183-4f70-93fb-2f488000ce4c?v=full", 66 | "resourceAlias": "systemsetting" 67 | } 68 | ], 69 | "resourceVersion": "1.9" 70 | } 71 | ``` 72 | 73 | Retrieves current Address Template. 74 | 75 | ## Update Address Template 76 | 77 | > Update Address Template 78 | 79 | ```shell 80 | POST /systemsetting/layout.address.format 81 | { 82 | "value": "\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n address1\n address2\n cityVillage stateProvince country postalCode\n \n " 83 | } 84 | ``` 85 | 86 | ```java 87 | OkHttpClient client = new OkHttpClient().newBuilder() 88 | .build(); 89 | MediaType mediaType = MediaType.parse("application/json"); 90 | RequestBody body = RequestBody.create(mediaType, "{\n \"value\": \"\\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n \\n address1\\n address2\\n cityVillage stateProvince country postalCode\\n \\n \"\n}"); 91 | Request request = new Request.Builder() 92 | .url("/openmrs/ws/rest/v1/systemsetting/layout.address.format") 93 | .method("POST", body) 94 | .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=") 95 | .addHeader("Content-Type", "application/json") 96 | .addHeader("Cookie", "JSESSIONID=1B06650EB0428F51EC119C909F58327C") 97 | .build(); 98 | Response response = client.newCall(request).execute(); 99 | ``` 100 | 101 | ```javascript 102 | var requestHeaders = new Headers(); 103 | requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM="); 104 | requestHeaders.append("Content-Type", "application/json"); 105 | requestHeaders.append("Cookie", "JSESSIONID=1B06650EB0428F51EC119C909F58327C"); 106 | var raw = JSON.stringify({"value": "\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n address1\n address2\n cityVillage stateProvince country postalCode\n \n "}); 107 | var requestOptions = { 108 | method: 'POST', 109 | headers: requestHeaders, 110 | body: raw, 111 | redirect: 'follow' 112 | }; 113 | fetch("/openmrs/ws/rest/v1/systemsetting/layout.address.format", requestOptions) 114 | .then(response => response.text()) 115 | .then(result => console.log(result)) 116 | .catch(error => console.log('error', error)); 117 | ``` 118 | 119 | Updates current Address Template with new XML sent in field `value`. 120 | -------------------------------------------------------------------------------- /source/includes/AdministrationLinks/administration_links.md: -------------------------------------------------------------------------------- 1 | # Administration Links 2 | 3 | ## Administration Links Overview 4 | 5 | Every installed module can register its administration pages. They are accessible through Legacy UI at [openmrs/admin/index.htm](openmrs/admin/index.htm) 6 | 7 | The following endpoints allow users to return list of installed modules with their administration links. 8 | 9 | ## Available Operations for Administration Links type 10 | 11 | 1. [List Administration Links](#list-administration-links) 12 | 13 | ## List Administration Links 14 | 15 | > List Administration Links 16 | 17 | ```shell 18 | GET /administrationlinks?v=default 19 | ``` 20 | 21 | ```java 22 | OkHttpClient client = new OkHttpClient().newBuilder() 23 | .build(); 24 | Request request = new Request.Builder() 25 | .url("/openmrs/ws/rest/v1/administrationlinks?v=default") 26 | .method("GET", null) 27 | .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=") 28 | .addHeader("Cookie", "JSESSIONID=DF385B2E6E39E0BB49BB7E079BF31C44") 29 | .build(); 30 | Response response = client.newCall(request).execute(); 31 | ``` 32 | 33 | ```javascript 34 | var myHeaders = new Headers(); 35 | myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM="); 36 | myHeaders.append("Cookie", "JSESSIONID=DF385B2E6E39E0BB49BB7E079BF31C44"); 37 | 38 | var requestOptions = { 39 | method: 'GET', 40 | headers: myHeaders, 41 | redirect: 'follow' 42 | }; 43 | 44 | fetch("/openmrs/ws/rest/v1/administrationlinks?v=default", requestOptions) 45 | .then(response => response.text()) 46 | .then(result => console.log(result)) 47 | .catch(error => console.log('error', error)); 48 | ``` 49 | 50 | > Success Response 51 | 52 | ```response 53 | { 54 | "results": [ 55 | { 56 | "uuid": "webservices.rest", 57 | "display": "REST Web Services", 58 | "title": "REST Web Services", 59 | "administrationLinks": { 60 | "module/webservices/rest/settings.form": "Settings", 61 | "module/webservices/rest/test.htm": "Test", 62 | "module/webservices/rest/apiDocs.htm": "API Documentation" 63 | }, 64 | "links": [ 65 | { 66 | "rel": "self", 67 | "uri": "http://localhost:8080/openmrs/ws/rest/v1/administrationlinks/webservices.rest", 68 | "resourceAlias": "administrationlinks" 69 | } 70 | ] 71 | }, 72 | { 73 | "uuid": "owa", 74 | "display": "Open Web Apps Module", 75 | "title": "Open Web Apps Module", 76 | "administrationLinks": { 77 | "/module/owa/manager.form": "Manage Apps", 78 | "/module/owa/settings.form": "Settings" 79 | }, 80 | "links": [ 81 | { 82 | "rel": "self", 83 | "uri": "http://localhost:8080/openmrs/ws/rest/v1/administrationlinks/owa", 84 | "resourceAlias": "administrationlinks" 85 | } 86 | ] 87 | }, 88 | { 89 | "uuid": "openconceptlab", 90 | "display": "Open Concept Lab", 91 | "title": "Open Concept Lab", 92 | "administrationLinks": { 93 | "/owa/openconceptlab/index.html#/subscription": "Configuration Page", 94 | "/owa/openconceptlab/index.html#/": "Status Page" 95 | }, 96 | "links": [ 97 | { 98 | "rel": "self", 99 | "uri": "http://localhost:8080/openmrs/ws/rest/v1/administrationlinks/openconceptlab", 100 | "resourceAlias": "administrationlinks" 101 | } 102 | ] 103 | } 104 | ] 105 | } 106 | ``` 107 | 108 | * Fetches all installed modules with their administration links. Returns a `200 OK` status with the List of AdministrationLinks response. 109 | 110 | ## List Administration Links by module ID 111 | 112 | > List Administration Links by module ID 113 | 114 | ```shell 115 | GET /administrationlinks/:moduleId 116 | ``` 117 | 118 | ```java 119 | OkHttpClient client = new OkHttpClient().newBuilder() 120 | .build(); 121 | Request request = new Request.Builder() 122 | .url("/openmrs/ws/rest/v1/administrationlinks/:moduleId") 123 | .method("GET", null) 124 | .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=") 125 | .addHeader("Cookie", "JSESSIONID=DF385B2E6E39E0BB49BB7E079BF31C44") 126 | .build(); 127 | Response response = client.newCall(request).execute(); 128 | ``` 129 | 130 | ```javascript 131 | var myHeaders = new Headers(); 132 | myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM="); 133 | myHeaders.append("Cookie", "JSESSIONID=DF385B2E6E39E0BB49BB7E079BF31C44"); 134 | 135 | var requestOptions = { 136 | method: 'GET', 137 | headers: myHeaders, 138 | redirect: 'follow' 139 | }; 140 | 141 | fetch("/openmrs/ws/rest/v1/administrationlinks/:moduleId", requestOptions) 142 | .then(response => response.text()) 143 | .then(result => console.log(result)) 144 | .catch(error => console.log('error', error)); 145 | ``` 146 | 147 | > Success Response 148 | 149 | ```response 150 | { 151 | "uuid": "webservices.rest", 152 | "display": "REST Web Services", 153 | "title": "REST Web Services", 154 | "administrationLinks": { 155 | "module/webservices/rest/settings.form": "Settings", 156 | "module/webservices/rest/test.htm": "Test", 157 | "module/webservices/rest/apiDocs.htm": "API Documentation" 158 | }, 159 | "links": [ 160 | { 161 | "rel": "self", 162 | "uri": "http://localhost:8080/openmrs/ws/rest/v1/administrationlinks/webservices.rest", 163 | "resourceAlias": "administrationlinks" 164 | } 165 | ], 166 | "resourceVersion": "1.8" 167 | } 168 | ``` 169 | 170 | * Fetches administration links of given module by its id. Returns a `404 Not Found` status if the module does not have any links registered. If the user is not logged in to perform this action, a `401 Unauthorized` status is returned. 171 | -------------------------------------------------------------------------------- /source/includes/Alerts/alerts.md: -------------------------------------------------------------------------------- 1 | # Alert 2 | 3 | ## Alert Overview 4 | 5 | Alert is a notification that selected users receive on the main page of Legacy UI. 6 | 7 | ## Available operations for Alert 8 | 9 | 1. [List alerts](#list-all-alerts) 10 | 2. [Create an alert](#create-an-alert) 11 | 3. [Update an alert](#update-an-alert) 12 | 4. [Delete an alert](#delete-an-alert) 13 | 14 | ## List all alerts 15 | 16 | > Get all alerts 17 | 18 | ```shell 19 | GET alert?v=default 20 | ``` 21 | 22 | ```java 23 | OkHttpClient client = new OkHttpClient().newBuilder() 24 | .build(); 25 | Request request = new Request.Builder() 26 | .url("/openmrs/ws/rest/v1/alert?v=default 27 | &v=default") 28 | .method("GET", null) 29 | .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=") 30 | .addHeader("Cookie", "JSESSIONID=A2AF09658C73E1ECEC5D3C8C7C249A2D") 31 | .build(); 32 | Response response = client.newCall(request).execute(); 33 | ``` 34 | 35 | ```javascript 36 | var requestHeaders = new Headers(); 37 | requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM="); 38 | requestHeaders.append("Cookie", "JSESSIONID=A2AF09658C73E1ECEC5D3C8C7C249A2D"); 39 | 40 | var requestOptions = { 41 | method: 'GET', 42 | headers: requestHeaders, 43 | redirect: 'follow' 44 | }; 45 | 46 | fetch("/openmrs/ws/rest/v1/alert?v=default", requestOptions) 47 | .then(response => response.text()) 48 | .then(result => console.log(result)) 49 | .catch(error => console.log('error', error)); 50 | ``` 51 | 52 | > Success Response 53 | 54 | ```response 55 | { 56 | "results": [ 57 | { 58 | "uuid": "b4f9a6a0-2791-4106-ba94-28cb84d5aaae", 59 | "display": "There was an error starting the module: Reference Demo Data Module", 60 | "alertId": 6, 61 | "text": "There was an error starting the module: Reference Demo Data Module", 62 | "satisfiedByAny": true, 63 | "dateToExpire": "2021-06-15T00:00:00.000+0200", 64 | "alertRead": true, 65 | "recipients": [ 66 | { 67 | "uuid": "c3e9fe79-9af1-4d6f-9113-5ded3db4582d", 68 | "display": "Super User (admin)", 69 | "links": [ 70 | { 71 | "rel": "self", 72 | "uri": "http://localhost:8080/openmrs/ws/rest/v1/alert/b4f9a6a0-2791-4106-ba94-28cb84d5aaae/recipient/c3e9fe79-9af1-4d6f-9113-5ded3db4582d", 73 | "resourceAlias": "recipient" 74 | } 75 | ] 76 | } 77 | ], 78 | "links": [ 79 | { 80 | "rel": "self", 81 | "uri": "http://localhost:8080/openmrs/ws/rest/v1/alert/b4f9a6a0-2791-4106-ba94-28cb84d5aaae", 82 | "resourceAlias": "alert" 83 | }, 84 | { 85 | "rel": "full", 86 | "uri": "http://localhost:8080/openmrs/ws/rest/v1/alert/b4f9a6a0-2791-4106-ba94-28cb84d5aaae?v=full", 87 | "resourceAlias": "alert" 88 | } 89 | ], 90 | "resourceVersion": "1.8" 91 | }, 92 | { 93 | "uuid": "bf40f1e9-16cb-452e-bf2c-0f9c0863d3e4", 94 | "display": "There was an error starting the module: Attachments", 95 | "alertId": 7, 96 | "text": "There was an error starting the module: Attachments", 97 | "satisfiedByAny": true, 98 | "dateToExpire": "2021-06-15T21:33:19.000+0200", 99 | "alertRead": true, 100 | "recipients": [ 101 | { 102 | "uuid": "6dabf122-75f7-4dba-a12f-28ced570d922", 103 | "display": "Super User (admin)", 104 | "links": [ 105 | { 106 | "rel": "self", 107 | "uri": "http://localhost:8080/openmrs/ws/rest/v1/alert/bf40f1e9-16cb-452e-bf2c-0f9c0863d3e4/recipient/6dabf122-75f7-4dba-a12f-28ced570d922", 108 | "resourceAlias": "recipient" 109 | } 110 | ] 111 | } 112 | ], 113 | "links": [ 114 | { 115 | "rel": "self", 116 | "uri": "http://localhost:8080/openmrs/ws/rest/v1/alert/bf40f1e9-16cb-452e-bf2c-0f9c0863d3e4", 117 | "resourceAlias": "alert" 118 | }, 119 | { 120 | "rel": "full", 121 | "uri": "http://localhost:8080/openmrs/ws/rest/v1/alert/bf40f1e9-16cb-452e-bf2c-0f9c0863d3e4?v=full", 122 | "resourceAlias": "alert" 123 | } 124 | ], 125 | "resourceVersion": "1.8" 126 | } 127 | ], 128 | "links": [ 129 | { 130 | "rel": "next", 131 | "uri": "http://localhost:8080/openmrs/ws/rest/v1/alert?v=default&startIndex=50", 132 | "resourceAlias": null 133 | } 134 | ] 135 | } 136 | ``` 137 | 138 | You can add an `includeExpired=true` parameter to return also expired Alerts. 139 | If not logged in to perform this action, a `401 Unauthorized` status is returned. 140 | 141 | ### Query Parameters 142 | 143 | | Parameter | Type | Description | 144 | | ---------------- | -------------- | ------------------------------------- | 145 | | _includeExpired_ | `Boolean` | Include expired alerts | 146 | 147 | 148 | ## Create an alert 149 | 150 | > Create an alert 151 | 152 | ```shell 153 | { 154 | "text": "New alert", 155 | "satisfiedByAny": true, 156 | "dateToExpire": null, 157 | "recipients": [ 158 | { 159 | "recipient": "c98a1558-e131-11de-babe-001e378eb67e" 160 | } 161 | ] 162 | } 163 | ``` 164 | 165 | ```java 166 | OkHttpClient client = new OkHttpClient().newBuilder() 167 | .build(); 168 | MediaType mediaType = MediaType.parse("application/json"); 169 | RequestBody body = RequestBody.create(mediaType, "{\"text\": \"New alert\",\"satisfiedByAny\": true,\"dateToExpire\": null,\"recipients\": [{\"recipient\": \"c98a1558-e131-11de-babe-001e378eb67e\"}]}"); 170 | Request request = new Request.Builder() 171 | .url("/openmrs/ws/rest/v1/alert") 172 | .method("POST", body) 173 | .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=") 174 | .addHeader("Content-Type", "application/json") 175 | .addHeader("Cookie", "JSESSIONID=DF385B2E6E39E0BB49BB7E079BF31C44") 176 | .build(); 177 | Response response = client.newCall(request).execute(); 178 | ``` 179 | 180 | ```javascript 181 | var myHeaders = new Headers(); 182 | myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM="); 183 | myHeaders.append("Content-Type", "application/json"); 184 | myHeaders.append("Cookie", "JSESSIONID=DF385B2E6E39E0BB49BB7E079BF31C44"); 185 | 186 | var raw = JSON.stringify({"text": "New alert","satisfiedByAny": true,"dateToExpire": null,"recipients": [{"recipient": "c98a1558-e131-11de-babe-001e378eb67e"}]}); 187 | 188 | var requestOptions = { 189 | method: 'POST', 190 | headers: myHeaders, 191 | body: raw, 192 | redirect: 'follow' 193 | }; 194 | 195 | fetch("/openmrs/ws/rest/v1/alert", requestOptions) 196 | .then(response => response.text()) 197 | .then(result => console.log(result)) 198 | .catch(error => console.log('error', error)); 199 | ``` 200 | 201 | You can create a new alert with its recipients by using User's UUID as recipient's field value. 202 | If you are not logged in to perform this action, a `401 Unauthorized` status is returned. 203 | 204 | ### Attributes 205 | 206 | Parameter | Type | Description 207 | --------------------------- | ---------------------- | ---- 208 | *text* | `String` | Text of the alert 209 | *satisfiedByAny* | `Boolean` | If true, this alert will be marked as read if only one of its recipients has read it 210 | *dateToExpire* | `Date` | Date when the alert will become expired 211 | *recipients* | `Array[] : recipient` | List of alert's recipients 212 | 213 | ## Update an alert using its UUID 214 | 215 | > Update an alert 216 | 217 | ```shell 218 | { 219 | "text": "Updated alert" 220 | } 221 | ``` 222 | 223 | ```java 224 | OkHttpClient client = new OkHttpClient().newBuilder() 225 | .build(); 226 | MediaType mediaType = MediaType.parse("application/json"); 227 | RequestBody body = RequestBody.create(mediaType, "{\r\n \"text\": \"Updated alert\"\r\n}\r\n"); 228 | Request request = new Request.Builder() 229 | .url("/openmrs/ws/rest/v1/alert/:alert_uuid") 230 | .method("POST", body) 231 | .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=") 232 | .addHeader("Content-Type", "application/json") 233 | .addHeader("Cookie", "JSESSIONID=DF385B2E6E39E0BB49BB7E079BF31C44") 234 | .build(); 235 | Response response = client.newCall(request).execute(); 236 | ``` 237 | 238 | ```javascript 239 | var myHeaders = new Headers(); 240 | myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM="); 241 | myHeaders.append("Content-Type", "application/json"); 242 | myHeaders.append("Cookie", "JSESSIONID=DF385B2E6E39E0BB49BB7E079BF31C44"); 243 | 244 | var raw = JSON.stringify({"text":"Updated alert"}); 245 | 246 | var requestOptions = { 247 | method: 'POST', 248 | headers: myHeaders, 249 | body: raw, 250 | redirect: 'follow' 251 | }; 252 | 253 | fetch("/openmrs/ws/rest/v1/alert/:alert_uuid", requestOptions) 254 | .then(response => response.text()) 255 | .then(result => console.log(result)) 256 | .catch(error => console.log('error', error)); 257 | ``` 258 | 259 | Update an alert with given UUID. Returns a `404 Not Found` status if the alert does not exist. If not logged in to perform this action, a `401 Unauthorized` status is returned. 260 | 261 | ### Attributes 262 | 263 | Parameter | Type | Description 264 | --------------------------- | ---------------------- | ---- 265 | *text* | `String` | Text of the alert 266 | *satisfiedByAny* | `Boolean` | If true, this alert will be marked as read if only one of its recipients has read it 267 | *dateToExpire* | `Date` | Date when the alert will become expired 268 | *recipients* | `Array[] : recipient` | List of alert's recipients 269 | 270 | ## Delete an alert 271 | 272 | > Delete an alert using its UUID 273 | 274 | ```shell 275 | DELETE /alert/:alert_uuid?purge=true 276 | ``` 277 | 278 | ```java 279 | OkHttpClient client = new OkHttpClient().newBuilder() 280 | .build(); 281 | MediaType mediaType = MediaType.parse("text/plain"); 282 | RequestBody body = RequestBody.create(mediaType, ""); 283 | Request request = new Request.Builder() 284 | .url("/openmrs/ws/rest/v1/alert/:alert_uuid?purge=true") 285 | .method("DELETE", body) 286 | .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=") 287 | .addHeader("Cookie", "JSESSIONID=154692F02BBBC664825F3C4C224A474B") 288 | .build(); 289 | Response response = client.newCall(request).execute(); 290 | ``` 291 | 292 | ```javascript 293 | var requestHeaders = new Headers(); 294 | requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM="); 295 | requestHeaders.append("Cookie", "JSESSIONID=955E778A4F700C5AA9651DAF6FC9DDDA"); 296 | 297 | var requestOptions = { 298 | method: 'DELETE', 299 | headers: requestHeaders, 300 | redirect: 'follow' 301 | }; 302 | 303 | fetch("https://demo.openmrs.org/openmrs/ws/rest/v1/alert/:alert_uuid?purge=true", requestOptions) 304 | .then(response => response.text()) 305 | .then(result => console.log(result)) 306 | .catch(error => console.log('error', error)); 307 | ``` 308 | 309 | Deletes (purges) an alert by its UUID. Returns a `404 Not Found` status if the user does not exist. If not logged in to perform this action, a `401 Unauthorized` status is returned. 310 | 311 | Voiding alerts is not supported. 312 | -------------------------------------------------------------------------------- /source/includes/Concepts/concept_data_type.md: -------------------------------------------------------------------------------- 1 | # Concept Data Type 2 | 3 | ## Concept Data Type Overview 4 | 5 | * Concept Data type defines the structured format you desired the data to be represented. 6 | 7 | ### Current types are as follows: 8 | 9 | ### 1. Numeric 10 | Any data represented numerically, also allows you to classify critical values and units, e.g., age, height, and liters consumed per day. 11 | 12 | ### 2. Coded 13 | Allows answers to be only those provided, since value determined by term dictionary lookup (i.e., term identifier) e.g., blood type can only be `“A,” “B,” "AB," or “O.”`. 14 | 15 | ### 3. Text 16 | Open-ended responses. 17 | 18 | ### 4. N/A 19 | The standard datatype for any non-query-like concepts (answers or things), e.g., symptoms, diagnoses, findings, anatomy, misc. 20 | 21 | ### 5. Document 22 | Pointer to a binary or text-based document (e.g., clinical document, RTF, XML, EKG, image, etc.) stored in complex_obs table. 23 | 24 | ### 6. Date 25 | Structured day, month, and year. 26 | 27 | ### 7. Time 28 | Structured time response. 29 | 30 | ### 8. DateTime 31 | Structured response including both the date and the time 32 | 33 | ### 9. Boolean 34 | Checkbox response, e.g., yes or no queries 35 | 36 | ### 10. Rule 37 | Value derived from other data 38 | 39 | ### 11. Structured Numeric 40 | Complex numeric values possible (ie, <5, 1-10, etc.). 41 | 42 | ### 12. Complex 43 | Complex value, analogous to HL7 Embedded Datatype. 44 | 45 | 46 | ## Available operations for Concept Data Type. 47 | 48 | 1. [List concept_data types](#list-concept-data-types) 49 | 4. [Delete a concept_data type](#delete-a-concept_data-type) 50 | 51 | 52 | ## List concept data types 53 | 54 | ## List all non-retired concept data types. 55 | 56 | > List all non-retired concept data types 57 | 58 | ```shell 59 | GET /conceptdatatype" 60 | ``` 61 | 62 | ```java 63 | 64 | OkHttpClient client = new OkHttpClient().newBuilder() 65 | .build(); 66 | Request request = new Request.Builder() 67 | .url("/openmrs/ws/rest/v1/conceptdatatype?limit=1") 68 | .method("GET", null) 69 | .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=") 70 | .addHeader("Cookie", "JSESSIONID=66002746B1A29A6E9CA461CD6309BCC2") 71 | .build(); 72 | Response response = client.newCall(request).execute(); 73 | 74 | ``` 75 | 76 | ```javascript 77 | 78 | var myHeaders = new Headers(); 79 | myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM="); 80 | myHeaders.append("Cookie", "JSESSIONID=66002746B1A29A6E9CA461CD6309BCC2"); 81 | 82 | var requestOptions = { 83 | method: 'GET', 84 | headers: myHeaders, 85 | redirect: 'follow' 86 | }; 87 | 88 | fetch("/openmrs/ws/rest/v1/conceptdatatype?limit=1", requestOptions) 89 | .then(response => response.text()) 90 | .then(result => console.log(result)) 91 | .catch(error => console.log('error', error)); 92 | 93 | ``` 94 | 95 | > Success response 96 | 97 | ```response 98 | { 99 | "results": [ 100 | { 101 | "uuid": "8d4a4488-c2cc-11de-8d13-0010c6dffd0f", 102 | "display": "Numeric", 103 | "links": [ 104 | { 105 | "rel": "self", 106 | "uri": "http://qa-refapp.openmrs.org/openmrs/ws/rest/v1/conceptdatatype/8d4a4488-c2cc-11de-8d13-0010c6dffd0f" 107 | } 108 | ] 109 | } 110 | ], 111 | "links": [ 112 | { 113 | "rel": "next", 114 | "uri": "http://qa-refapp.openmrs.org/openmrs/ws/rest/v1/conceptdatatype?limit=1&startIndex=1" 115 | } 116 | ] 117 | } 118 | ``` 119 | * Get concept data types. Returns a `404 Not Found` status if concept data type not exists. 120 | If the user is not logged in to perform this action, a `401 Unauthorized` status returned. 121 | 122 | 123 | ## Get concept data type by UUID. 124 | 125 | > Get concept data type by UUID 126 | 127 | ```shell 128 | GET /conceptdatatype/:target_concept_data_type_uuid 129 | ``` 130 | ```java 131 | 132 | OkHttpClient client = new OkHttpClient().newBuilder() 133 | .build(); 134 | Request request = new Request.Builder() 135 | .url("/openmrs/ws/rest/v1/conceptdatatype/8d4a4488-c2cc-11de-8d13-0010c6dffd0f") 136 | .method("GET", null) 137 | .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=") 138 | .addHeader("Cookie", "JSESSIONID=C40164E7FA407F9E872B0BBDBB4582B0") 139 | .build(); 140 | Response response = client.newCall(request).execute(); 141 | 142 | ``` 143 | 144 | ```javascript 145 | 146 | var myHeaders = new Headers(); 147 | myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM="); 148 | myHeaders.append("Cookie", "JSESSIONID=C40164E7FA407F9E872B0BBDBB4582B0"); 149 | 150 | var requestOptions = { 151 | method: 'GET', 152 | headers: myHeaders, 153 | redirect: 'follow' 154 | }; 155 | 156 | fetch("/openmrs/ws/rest/v1/conceptdatatype/8d4a4488-c2cc-11de-8d13-0010c6dffd0f", requestOptions) 157 | .then(response => response.text()) 158 | .then(result => console.log(result)) 159 | .catch(error => console.log('error', error)); 160 | 161 | ``` 162 | 163 | * Retrieve a concept data type by its UUID. Returns a `404 Not Found` status if concept data type not exists. If the user is not logged in to perform this action, a `401 Unauthorized` status returned. 164 | 165 | 166 | ## Delete a concept data type 167 | 168 | > Delete a concept data type 169 | 170 | ```shell 171 | DELETE /conceptdatatype/:target_concept_data_type_uuid?purge=true 172 | ``` 173 | 174 | ```java 175 | 176 | OkHttpClient client = new OkHttpClient().newBuilder() 177 | .build(); 178 | MediaType mediaType = MediaType.parse("text/plain"); 179 | RequestBody body = RequestBody.create(mediaType, ""); 180 | Request request = new Request.Builder() 181 | .url("/openmrs/ws/rest/v1/conceptdatatype/8d4a4488-c2cc-11de-8d13-0010c6dffd0f?purge=true") 182 | .method("DELETE", body) 183 | .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=") 184 | .addHeader("Cookie", "JSESSIONID=C40164E7FA407F9E872B0BBDBB4582B0") 185 | .build(); 186 | Response response = client.newCall(request).execute(); 187 | 188 | ``` 189 | 190 | ```javascript 191 | 192 | var myHeaders = new Headers(); 193 | myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM="); 194 | myHeaders.append("Cookie", "JSESSIONID=C40164E7FA407F9E872B0BBDBB4582B0"); 195 | 196 | var requestOptions = { 197 | method: 'DELETE', 198 | headers: myHeaders, 199 | redirect: 'follow' 200 | }; 201 | 202 | fetch("/openmrs/ws/rest/v1/conceptdatatype/8d4a4488-c2cc-11de-8d13-0010c6dffd0f?purge=true", requestOptions) 203 | .then(response => response.text()) 204 | .then(result => console.log(result)) 205 | .catch(error => console.log('error', error)); 206 | 207 | ``` 208 | 209 | * Delete or retire a target concept data type by its UUID. Returns a `404 Not Found` 210 | status if concept data not exists. If the user is not logged in to perform this action, 211 | a `401 Unauthorized` status returned. 212 | * A `400 Bad Request` status is returned when the resource dosent support deletion. 213 | 214 | ### Query Parameters 215 | 216 | Parameter | Type | Description 217 | --- | --- | --- 218 | *purge* | `Boolean` | The resource will be voided/retired unless purge = ‘true’ 219 | 220 | -------------------------------------------------------------------------------- /source/includes/Concepts/concept_map_type.md: -------------------------------------------------------------------------------- 1 | # Concept Map Type 2 | 3 | ## Overview 4 | 5 | * Concept mappings are generally used to map between a local concept and an external concept, most often a reference (standard) terminology but sometimes concepts from other systems with which you need to Inter operate (i.e., transform data moving between systems). 6 | * Mappings are useful when you need to receive or send information to external systems, letting you define how your system's concepts relate to external concepts such as standardized medical vocabularies (e.g., ICD, LOINC, SNOMED). 7 | 8 | * For example, add a mapping to a concept in the MCL dictionary. You can save the concept now and create some answers. for instance, 9 | create the concepts PLANNING PREGNANCY and CURRENTLY PREGNANT of Class Finding and Datatype Boolean. The last possible answer will be the OTHER of Class Misc and Datatype N/A. After creating three new concepts, you can edit ANTENATAL VISIT REASON and add them as answers. 10 | 11 | ## Available operations. 12 | 13 | 1. [List concept mapping types](#list-concept-map-types) 14 | 2. [Create a concept mapping type](#create-a-concept-map-type) 15 | 3. [Update a concept mapping typee](#update-a-concept-map-type) 16 | 4. [Delete a concept mapping type](#delete-a-concept-map-type) 17 | 18 | 19 | ## List concept map types 20 | 21 | > List all non-retired concept map types 22 | 23 | ```shell 24 | GET /conceptmaptype?q=associated 25 | ``` 26 | 27 | ```java 28 | 29 | OkHttpClient client = new OkHttpClient().newBuilder() 30 | .build(); 31 | Request request = new Request.Builder() 32 | .url("/openmrs/ws/rest/v1/conceptmaptype?q=associated&limit=1") 33 | .method("GET", null) 34 | .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=") 35 | .addHeader("Cookie", "JSESSIONID=C40164E7FA407F9E872B0BBDBB4582B0") 36 | .build(); 37 | Response response = client.newCall(request).execute(); 38 | 39 | ``` 40 | 41 | ```javascript 42 | 43 | var myHeaders = new Headers(); 44 | myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM="); 45 | myHeaders.append("Cookie", "JSESSIONID=C40164E7FA407F9E872B0BBDBB4582B0"); 46 | 47 | var requestOptions = { 48 | method: 'GET', 49 | headers: myHeaders, 50 | redirect: 'follow' 51 | }; 52 | 53 | fetch("/openmrs/ws/rest/v1/conceptmaptype?q=associated&limit=1", requestOptions) 54 | .then(response => response.text()) 55 | .then(result => console.log(result)) 56 | .catch(error => console.log('error', error)); 57 | 58 | ``` 59 | 60 | > Success Response 61 | 62 | ```response 63 | { 64 | "results": [ 65 | { 66 | "uuid": "55e02065-7d8c-11e1-909d-c80aa9edcf4e", 67 | "display": "Associated finding", 68 | "links": [ 69 | { 70 | "rel": "self", 71 | "uri": "/openmrs/ws/rest/v1/conceptmaptype/55e02065-7d8c-11e1-909d-c80aa9edcf4e" 72 | } 73 | ] 74 | } 75 | ], 76 | "links": [ 77 | { 78 | "rel": "next", 79 | "uri": "/openmrs/ws/rest/v1/conceptmaptype?q=associated&limit=1&startIndex=1" 80 | } 81 | ] 82 | } 83 | ``` 84 | 85 | * Quickly filter concept map types with a given search query. Returns a `404 Not Found` status if concept map type not exists. 86 | If the user is not logged in to perform this action, a `401 Unauthorized` status returned. 87 | 88 | ### Query Parameters 89 | 90 | Parameter | Type | Description 91 | --- | --- | --- 92 | *q* | `String` | Full or partial name search term. Search is case insensitive. 93 | 94 | 95 | ## List concept map type by UUID. 96 | 97 | > List concept map type by UUID 98 | 99 | ```shell 100 | GET /conceptmaptype/:target_concept_map_type_uuid 101 | ``` 102 | ```java 103 | 104 | OkHttpClient client = new OkHttpClient().newBuilder() 105 | .build(); 106 | Request request = new Request.Builder() 107 | .url("/openmrs/ws/rest/v1/conceptmaptype/55e02065-7d8c-11e1-909d-c80aa9edcf4e") 108 | .method("GET", null) 109 | .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=") 110 | .addHeader("Cookie", "JSESSIONID=CDA2E6D4A724D5E5DC294136C185284C") 111 | .build(); 112 | Response response = client.newCall(request).execute(); 113 | 114 | ``` 115 | 116 | ```javascript 117 | 118 | var myHeaders = new Headers(); 119 | myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM="); 120 | myHeaders.append("Cookie", "JSESSIONID=CDA2E6D4A724D5E5DC294136C185284C"); 121 | 122 | var requestOptions = { 123 | method: 'GET', 124 | headers: myHeaders, 125 | redirect: 'follow' 126 | }; 127 | 128 | fetch("/openmrs/ws/rest/v1/conceptmaptype/55e02065-7d8c-11e1-909d-c80aa9edcf4e", requestOptions) 129 | .then(response => response.text()) 130 | .then(result => console.log(result)) 131 | .catch(error => console.log('error', error)); 132 | 133 | ``` 134 | 135 | * Retrieve a concept map type by its UUID. Returns a `404 Not Found` status if concept map type not exists. If user not logged in to perform this action, a `401 Unauthorized` status returned. 136 | 137 | 138 | ## Create a concept map type 139 | 140 | > Create a concept map type 141 | 142 | ```shell 143 | POST /conceptmaptype 144 | { 145 | "name": "SAME-AS", 146 | "description": "used to map concepts which are Identical", 147 | "isHidden": false 148 | } 149 | ``` 150 | 151 | ```java 152 | 153 | OkHttpClient client = new OkHttpClient().newBuilder() 154 | .build(); 155 | MediaType mediaType = MediaType.parse("application/json"); 156 | RequestBody body = RequestBody.create(mediaType, "{\r\n\t\"name\": \"SAME-AS\",\r\n\t\"description\":\"used to map concepts which are Identical\",\r\n\t\"isHidden\": false\r\n}\r\n{\r\n\t\"name\": \"SAME-AS\",\r\n\t\"description\":\"used to map concepts which are Identical\"\r\n\t\"isHidden\": false\r\n}\r\n"); 157 | Request request = new Request.Builder() 158 | .url("/openmrs/ws/rest/v1//conceptmaptype") 159 | .method("POST", body) 160 | .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=") 161 | .addHeader("Content-Type", "application/json") 162 | .addHeader("Cookie", "JSESSIONID=77AE436C4972FB63FC69B7836445489F") 163 | .build(); 164 | Response response = client.newCall(request).execute(); 165 | 166 | ``` 167 | 168 | ```javascript 169 | 170 | var myHeaders = new Headers(); 171 | myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM="); 172 | myHeaders.append("Content-Type", "application/json"); 173 | myHeaders.append("Cookie", "JSESSIONID=77AE436C4972FB63FC69B7836445489F"); 174 | 175 | var raw = "{\n \"name\": \"SAME-AS\",\n \"description\":\"used to map concepts which are Identical\",\n \"isHidden\": false\n}\n{\n \"name\": \"SAME-AS\",\n \"description\":\"used to map concepts which are Identical\"\n \"isHidden\": false\n}\n"; 176 | 177 | var requestOptions = { 178 | method: 'POST', 179 | headers: myHeaders, 180 | body: raw, 181 | redirect: 'follow' 182 | }; 183 | 184 | fetch("/openmrs/ws/rest/v1//conceptmaptype", requestOptions) 185 | .then(response => response.text()) 186 | .then(result => console.log(result)) 187 | .catch(error => console.log('error', error)); 188 | 189 | ``` 190 | 191 | * To Create a concept map type, you need to specify below attributes in the request body. If you are not logged in to perform this action, a `401 Unauthorized` status returned. 192 | * A `400 Bad request` status is returned if the name is already being used by some concept map type. 193 | 194 | ### Attributes 195 | 196 | Parameter | Type | Description 197 | --- | --- | --- 198 | *name* | `String` | Name of the concept mapping type (Required) 199 | *description* | `String` | A brief description of the concept mapping type 200 | *isHidden* | `Boolean` | State to record concept map is hidden or not 201 | 202 | ## Update a concept map type 203 | 204 | > Update a concept map type 205 | 206 | ```shell 207 | POST /conceptmaptype/:target_concept_map_type_uuid 208 | { 209 | "name": "SAME-AS", 210 | "description": "dummy update", 211 | "isHidden": true 212 | } 213 | ``` 214 | 215 | ```java 216 | 217 | OkHttpClient client = new OkHttpClient().newBuilder() 218 | .build(); 219 | MediaType mediaType = MediaType.parse("application/json"); 220 | RequestBody body = RequestBody.create(mediaType, "{\r\n\t\"name\": \"SAME-AS\",\r\n\t\"description\": \"dummy update\",\r\n\t\"isHidden\": false\r\n}\r\n{\r\n\t\"name\": \"SAME-AS\",\r\n\t\"description\":\"used to map concepts which are Identical\"\r\n\t\"isHidden\": false\r\n}\r\n"); 221 | Request request = new Request.Builder() 222 | .url("/openmrs/ws/rest/v1//conceptmaptype/35543629-7d8c-11e1-909d-c80aa9edcf4e") 223 | .method("POST", body) 224 | .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=") 225 | .addHeader("Content-Type", "application/json") 226 | .addHeader("Cookie", "JSESSIONID=77AE436C4972FB63FC69B7836445489F") 227 | .build(); 228 | Response response = client.newCall(request).execute(); 229 | 230 | ``` 231 | 232 | 233 | ```javascript 234 | 235 | var myHeaders = new Headers(); 236 | myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM="); 237 | myHeaders.append("Content-Type", "application/json"); 238 | myHeaders.append("Cookie", "JSESSIONID=77AE436C4972FB63FC69B7836445489F"); 239 | 240 | var raw = "{\n \"name\": \"SAME-AS\",\n \"description\": \"dummy update\",\n \"isHidden\": false\n}\n{\n \"name\": \"SAME-AS\",\n \"description\":\"used to map concepts which are Identical\"\n \"isHidden\": false\n}\n"; 241 | 242 | var requestOptions = { 243 | method: 'POST', 244 | headers: myHeaders, 245 | body: raw, 246 | redirect: 'follow' 247 | }; 248 | 249 | fetch("/openmrs/ws/rest/v1//conceptmaptype/35543629-7d8c-11e1-909d-c80aa9edcf4e", requestOptions) 250 | .then(response => response.text()) 251 | .then(result => console.log(result)) 252 | .catch(error => console.log('error', error)); 253 | 254 | ``` 255 | 256 | * Update a target concept map type with given UUID, this method only modifies properties in the request. Returns a `404 Not Found` status if concept map not exists. If the user is not logged in to perform this action, a `401 Unauthorized` status returned. 257 | 258 | ### Attributes 259 | 260 | Parameter | Type | Description 261 | --- | --- | --- 262 | *name* | `String` | Name of the concept mapping type 263 | *description* | `String` | A brief description of the concept mapping type 264 | *isHidden* | `Boolean` | State to record concept map is hidden or not 265 | 266 | 267 | ### Delete a concept map type 268 | 269 | > Delete a concept map type 270 | 271 | ```shell 272 | DELETE /conceptmaptype/:target_concept_map_type_uuid?purge=true 273 | ``` 274 | ```java 275 | 276 | OkHttpClient client = new OkHttpClient().newBuilder() 277 | .build(); 278 | MediaType mediaType = MediaType.parse("text/plain"); 279 | RequestBody body = RequestBody.create(mediaType, ""); 280 | Request request = new Request.Builder() 281 | .url("/openmrs/ws/rest/v1/conceptmaptype/55e02065-7d8c-11e1-909d-c80aa9edcf4e?purge=true") 282 | .method("DELETE", body) 283 | .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=") 284 | .addHeader("Cookie", "JSESSIONID=CDA2E6D4A724D5E5DC294136C185284C") 285 | .build(); 286 | Response response = client.newCall(request).execute(); 287 | 288 | ``` 289 | 290 | ```javascript 291 | 292 | var myHeaders = new Headers(); 293 | myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM="); 294 | myHeaders.append("Cookie", "JSESSIONID=CDA2E6D4A724D5E5DC294136C185284C"); 295 | 296 | var requestOptions = { 297 | method: 'DELETE', 298 | headers: myHeaders, 299 | redirect: 'follow' 300 | }; 301 | 302 | fetch("/openmrs/ws/rest/v1/conceptmaptype/55e02065-7d8c-11e1-909d-c80aa9edcf4e?purge=true", requestOptions) 303 | .then(response => response.text()) 304 | .then(result => console.log(result)) 305 | .catch(error => console.log('error', error)); 306 | 307 | ``` 308 | 309 | * Delete or Retire a target concept map type by its UUID. Returns a `404 Not Found` status if concept map not exists. If user not logged in to perform this action, a `401 Unauthorized` status returned. 310 | * A `500 Internal Server Error `status is returned if the concept map is currently in use. 311 | 312 | ### Query Parameters 313 | 314 | Parameter | Type | Description 315 | --- | --- | --- 316 | *purge* | `Boolean` | The resource will be voided/retired unless purge = ‘true’ 317 | 318 | -------------------------------------------------------------------------------- /source/includes/Concepts/concept_source.md: -------------------------------------------------------------------------------- 1 | # Concept Source 2 | 3 | ## Concept Source Overview 4 | 5 | * Concepts are often managed within a dictionary (as a collection of concepts). While OpenMRS has, it's own dictionary of concepts, other dictionaries may exist in other systems or as standardized reference terminologies (like LOINC or ICD). The authorities who manage these other concept dictionaries represent "Concept Sources." 6 | * For eg `PIH Malawi`:`Partners in Health Malawi concept dictionary`, `SNOMED CT`:`SNOMED Preferred mapping` etc. 7 | 8 | 9 | ## Available operations for Concept Source. 10 | 11 | 1. [List concept_source types](#list-concept-source) 12 | 2. [Create a concept_source](#create-a-concept-source) 13 | 3. [Update a concept_source type](#update-a-concept-source) 14 | 4. [Delete a concept_source type](#delete-a-concept-source) 15 | 16 | 17 | ## List concept source 18 | 19 | >List all non-retired concept source 20 | 21 | 22 | ```shell 23 | GET /conceptsource?q=pih&limit=1 24 | ``` 25 | ```java 26 | 27 | OkHttpClient client = new OkHttpClient().newBuilder() 28 | .build(); 29 | Request request = new Request.Builder() 30 | .url("/openmrs/ws/rest/v1/conceptsource?q=pih&limit=1") 31 | .method("GET", null) 32 | .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=") 33 | .addHeader("Cookie", "JSESSIONID=BB426C696078A92639710E2B54C97C4D") 34 | .build(); 35 | Response response = client.newCall(request).execute(); 36 | 37 | ``` 38 | 39 | ```javascript 40 | 41 | var myHeaders = new Headers(); 42 | myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM="); 43 | myHeaders.append("Cookie", "JSESSIONID=BB426C696078A92639710E2B54C97C4D"); 44 | 45 | var requestOptions = { 46 | method: 'GET', 47 | headers: myHeaders, 48 | redirect: 'follow' 49 | }; 50 | 51 | fetch("/openmrs/ws/rest/v1/conceptsource?q=pih&limit=1", requestOptions) 52 | .then(response => response.text()) 53 | .then(result => console.log(result)) 54 | .catch(error => console.log('error', error)); 55 | 56 | ``` 57 | 58 | > Success Response 59 | 60 | ```response 61 | { 62 | "results": [ 63 | { 64 | "uuid": "fb9aaaf1-65e2-4c18-b53c-16b575f2f385", 65 | "display": "PIH", 66 | "links": [ 67 | { 68 | "rel": "self", 69 | "uri": "/openmrs/ws/rest/v1/conceptsource/fb9aaaf1-65e2-4c18-b53c-16b575f2f385" 70 | } 71 | ] 72 | } 73 | ], 74 | "links": [ 75 | { 76 | "rel": "next", 77 | "uri": "/openmrs/ws/rest/v1/conceptsource?q=pih&limit=1&startIndex=1" 78 | } 79 | ] 80 | } 81 | 82 | ``` 83 | * Quickly filter concept source types with a given search query. Returns a `404 Not Found` status if concept source type not exists. If the user is not logged in to perform this action, a `401 Unauthorized` status returned. 84 | 85 | ### Query Parameters 86 | 87 | Parameter | Type | Description 88 | --- | --- | --- 89 | *q* | `String` | Full or partial match to concept source name. Search is case-insensitive for eg. PIH 90 | 91 | 92 | ## Query concept source by UUID 93 | 94 | > Query concept source by UUID 95 | 96 | ```shell 97 | GET /conceptsource/:target_concept_source_type_uuid 98 | ``` 99 | ```java 100 | 101 | OkHttpClient client = new OkHttpClient().newBuilder() 102 | .build(); 103 | Request request = new Request.Builder() 104 | .url("/openmrs/ws/rest/v1/conceptsource/1ADDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD") 105 | .method("GET", null) 106 | .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=") 107 | .addHeader("Cookie", "JSESSIONID=BB426C696078A92639710E2B54C97C4D") 108 | .build(); 109 | Response response = client.newCall(request).execute(); 110 | 111 | ``` 112 | ```javascript 113 | 114 | var myHeaders = new Headers(); 115 | myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM="); 116 | myHeaders.append("Cookie", "JSESSIONID=BB426C696078A92639710E2B54C97C4D"); 117 | 118 | var requestOptions = { 119 | method: 'GET', 120 | headers: myHeaders, 121 | redirect: 'follow' 122 | }; 123 | 124 | fetch("/openmrs/ws/rest/v1/conceptsource/1ADDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD", requestOptions) 125 | .then(response => response.text()) 126 | .then(result => console.log(result)) 127 | .catch(error => console.log('error', error)); 128 | 129 | ``` 130 | 131 | 132 | * Retrieve a concept source type by its UUID. Returns a `404 Not Found` status if concept source type not exists. If user not logged in to perform this action, a `401 Unauthorized` status returned. 133 | 134 | 135 | ## Create a concept source 136 | 137 | > Create a concept source 138 | 139 | ```shell 140 | POST /conceptsource 141 | { 142 | "name": "SNOMED CT", 143 | "description": "SNOMED Preferred mapping", 144 | "hl7Code": "SCT", 145 | "uniqueId":"2.16.840.1.113883.6.96" 146 | } 147 | ``` 148 | ```java 149 | 150 | OkHttpClient client = new OkHttpClient().newBuilder() 151 | .build(); 152 | MediaType mediaType = MediaType.parse("application/json"); 153 | RequestBody body = RequestBody.create(mediaType, "{\r\n \"name\": \"SNOMED CT\",\r\n \"description\": \"SNOMED Preferred mapping\",\r\n \"hl7Code\": \"SCT\",\r\n \"uniqueId\":\"2.16.840.1.113883.6.96\"\t\r\n}"); 154 | Request request = new Request.Builder() 155 | .url("/openmrs/ws/rest/v1/conceptsource/") 156 | .method("POST", body) 157 | .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=") 158 | .addHeader("Content-Type", "application/json") 159 | .addHeader("Cookie", "JSESSIONID=3359211CFE448283F1CDCE925E43545E") 160 | .build(); 161 | Response response = client.newCall(request).execute(); 162 | 163 | ``` 164 | 165 | ```javascript 166 | 167 | var myHeaders = new Headers(); 168 | myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM="); 169 | myHeaders.append("Content-Type", "application/json"); 170 | myHeaders.append("Cookie", "JSESSIONID=3359211CFE448283F1CDCE925E43545E"); 171 | 172 | var raw = JSON.stringify({"name":"SNOMED CT","description":"SNOMED Preferred mapping","hl7Code":"SCT","uniqueId":"2.16.840.1.113883.6.96"}); 173 | 174 | var requestOptions = { 175 | method: 'POST', 176 | headers: myHeaders, 177 | body: raw, 178 | redirect: 'follow' 179 | }; 180 | 181 | fetch("/openmrs/ws/rest/v1/conceptsource/", requestOptions) 182 | .then(response => response.text()) 183 | .then(result => console.log(result)) 184 | .catch(error => console.log('error', error)); 185 | 186 | ``` 187 | 188 | * To Create a concept source type you need to specify below attributes in the request body. If you are not logged in to perform this action,a `401 Unauthorized` status returned. 189 | * A `500 Internal Server Error` status is returned if the new concept source class name, description or Hl7Code is already used for some other concept source class. 190 | 191 | ### Attributes 192 | 193 | Parameter | Type | Description 194 | --- | --- | --- 195 | *name* | `String` | Name of the concept source type (Required) 196 | *description* | `String` | Description for the concept source type resource (Required) 197 | *hl7Code* | `String` | A short code defined by governing bodies like HL7 (as in Vocabulary Table 0396). Alternatively, this could be the "Implementation Id" code used by another OpenMRS installation to define its concepts and forms 198 | *uniqueId* | `String` | A globally unique id to for the concept source 199 | 200 | ## Update a concept source 201 | 202 | > Update a concept source 203 | 204 | ```shell 205 | POST /conceptsource/:target_concept_source_type_uuid 206 | { 207 | "name": "SNOMED CTS", 208 | "description": "SNOMED Preferred mapping", 209 | "hl7Code": "SCT" 210 | } 211 | 212 | ``` 213 | 214 | ```java 215 | 216 | OkHttpClient client = new OkHttpClient().newBuilder() 217 | .build(); 218 | MediaType mediaType = MediaType.parse("application/json"); 219 | RequestBody body = RequestBody.create(mediaType, "{\r\n \"name\": \"SNOMED CTS\",\r\n \"description\": \"SNOMED Preferred mapping\",\r\n \"hl7Code\": \"SCT\"\r\n}"); 220 | Request request = new Request.Builder() 221 | .url("/openmrs/ws/rest/v1/conceptsource/1ADDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD") 222 | .method("POST", body) 223 | .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=") 224 | .addHeader("Content-Type", "application/json") 225 | .addHeader("Cookie", "JSESSIONID=BB426C696078A92639710E2B54C97C4D") 226 | .build(); 227 | Response response = client.newCall(request).execute(); 228 | 229 | ``` 230 | 231 | ```javascript 232 | 233 | var myHeaders = new Headers(); 234 | myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM="); 235 | myHeaders.append("Content-Type", "application/json"); 236 | myHeaders.append("Cookie", "JSESSIONID=BB426C696078A92639710E2B54C97C4D"); 237 | 238 | var raw = JSON.stringify({"name":"SNOMED CTS","description":"SNOMED Preferred mapping","hl7Code":"SCT"}); 239 | 240 | var requestOptions = { 241 | method: 'POST', 242 | headers: myHeaders, 243 | body: raw, 244 | redirect: 'follow' 245 | }; 246 | 247 | fetch("/openmrs/ws/rest/v1/conceptsource/1ADDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD", requestOptions) 248 | .then(response => response.text()) 249 | .then(result => console.log(result)) 250 | .catch(error => console.log('error', error)); 251 | 252 | ``` 253 | 254 | * Update a target concept source type with given UUID, this method only modifies properties in the request. Returns a `404 Not Found` 255 | status if concept source not exists. If the user is not logged in to perform this action, a `401 Unauthorized` status returned. 256 | 257 | ### Attributes 258 | 259 | Parameter | Type | Description 260 | --- | --- | --- 261 | *name* | `String` | Name of the concept source type 262 | *description* | `String` | Description for the concept source type resource 263 | *hl7Code* | `String` | The 5-20 character code defined for this source by governing bodies. Alternatively, this could be the "Implementation Id" code used by another OpenMRS installation to define its concepts and forms 264 | *uniqueId* | `String` | A globally unique id to for the concept source 265 | 266 | 267 | ## Delete a concept source 268 | 269 | > Delete a concept source 270 | 271 | ```shell 272 | DELETE /conceptsource/:target_concept_source_type_uuid?purge=true 273 | ``` 274 | 275 | ```java 276 | 277 | OkHttpClient client = new OkHttpClient().newBuilder() 278 | .build(); 279 | MediaType mediaType = MediaType.parse("text/plain"); 280 | RequestBody body = RequestBody.create(mediaType, ""); 281 | Request request = new Request.Builder() 282 | .url("/openmrs/ws/rest/v1/conceptsource/9ADDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD?purge=true") 283 | .method("DELETE", body) 284 | .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=") 285 | .addHeader("Cookie", "JSESSIONID=BB426C696078A92639710E2B54C97C4D") 286 | .build(); 287 | Response response = client.newCall(request).execute(); 288 | ``` 289 | 290 | ```javascript 291 | 292 | var myHeaders = new Headers(); 293 | myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM="); 294 | myHeaders.append("Cookie", "JSESSIONID=BB426C696078A92639710E2B54C97C4D"); 295 | 296 | var requestOptions = { 297 | method: 'DELETE', 298 | headers: myHeaders, 299 | redirect: 'follow' 300 | }; 301 | 302 | fetch("/openmrs/ws/rest/v1/conceptsource/9ADDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD?purge=true", requestOptions) 303 | .then(response => response.text()) 304 | .then(result => console.log(result)) 305 | .catch(error => console.log('error', error)); 306 | ``` 307 | 308 | * Delete or Retire a target concept source type by its UUID. Returns a `404 Not Found` status if concept source not exists. If user not logged in to perform this action, a `401 Unauthorized` status returned. 309 | * If the target concept source is referenced somewhere else in the database a `500 Internal Server Error` status is returned. 310 | 311 | ### Query Parameters 312 | 313 | Parameter | Type | Description 314 | --- | --- | --- 315 | *purge* | `Boolean` | The resource will be voided/retired unless purge = ‘true’ 316 | 317 | -------------------------------------------------------------------------------- /source/includes/Concepts/concepts_class.md: -------------------------------------------------------------------------------- 1 | # Concept Class 2 | 3 | ## Overview 4 | 5 | * The concept's class provides a useful way to narrow down the scope of the information that the concept is intended to capture. 6 | * In this way, the class is helpful for data extraction. This classification details how a concept will be represented 7 | (i.e. as a question or an answer) when the information is stored. 8 | * OpenMRS contains several default classes to use when defining concepts, but implementation sites may also create additional custom concept classes for use. 9 | * examples of some concept classes are `Procedure`: `describes a clinical procedure`, `diagnosis`:`conclusion drawn through findings` e.t.c 10 | 11 | ## Available operations. 12 | 13 | 1. [List concept classes](#list-concept-classes) 14 | 2. [Create a concept class](#create-a-concept-class) 15 | 3. [Update a concept class](#update-a-concept-class) 16 | 4. [Delete a concept class](#delete-a-concept-class) 17 | 18 | 19 | ## List concept classes 20 | 21 | >List all non-retired concept classes 22 | 23 | ```shell 24 | GET /conceptclass?limit=1 25 | ``` 26 | ```java 27 | OkHttpClient client = new OkHttpClient().newBuilder() 28 | .build(); 29 | Request request = new Request.Builder() 30 | .url("/openmrs/ws/rest/v1/conceptclass?limit=1") 31 | .method("GET", null) 32 | .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=") 33 | .addHeader("Cookie", "JSESSIONID=4C92FA7F3401680513E023F3832D82FF") 34 | .build(); 35 | Response response = client.newCall(request).execute(); 36 | ``` 37 | 38 | ```javascript 39 | var myHeaders = new Headers(); 40 | myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM="); 41 | myHeaders.append("Cookie", "JSESSIONID=4C92FA7F3401680513E023F3832D82FF"); 42 | 43 | var requestOptions = { 44 | method: 'GET', 45 | headers: myHeaders, 46 | redirect: 'follow' 47 | }; 48 | 49 | fetch("/openmrs/ws/rest/v1/conceptclass?limit=1", requestOptions) 50 | .then(response => response.text()) 51 | .then(result => console.log(result)) 52 | .catch(error => console.log('error', error)); 53 | ``` 54 | 55 | > Success Response 56 | 57 | ```response 58 | { 59 | "results": [ 60 | { 61 | "uuid": "8d4907b2-c2cc-11de-8d13-0010c6dffd0f", 62 | "display": "Test", 63 | "links": [ 64 | { 65 | "rel": "self", 66 | "uri": "/openmrs/ws/rest/v1/conceptclass/8d4907b2-c2cc-11de-8d13-0010c6dffd0f" 67 | } 68 | ] 69 | } 70 | ], 71 | "links": [ 72 | { 73 | "rel": "next", 74 | "uri": "/openmrs/ws/rest/v1/conceptclass?limit=1&startIndex=1" 75 | } 76 | ] 77 | } 78 | ``` 79 | 80 | * List all concept classes with a given search query. Returns a `404 Not Found` status if concept classes not exist. 81 | If the user is not logged in to perform this action, a `401 Unauthorized` status returned. 82 | 83 | ## List concept class type by UUID. 84 | 85 | > List concept class type by UUID 86 | 87 | ```shell 88 | GET /conceptclass/:target_concept_class_uuid 89 | ``` 90 | 91 | ```java 92 | 93 | OkHttpClient client = new OkHttpClient().newBuilder() 94 | .build(); 95 | Request request = new Request.Builder() 96 | .url("/openmrs/ws/rest/v1/conceptclass/8d4907b2-c2cc-11de-8d13-0010c6dffd0f") 97 | .method("GET", null) 98 | .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=") 99 | .addHeader("Cookie", "JSESSIONID=FD046011463ABEF58A36F3C87DADC88B") 100 | .build(); 101 | Response response = client.newCall(request).execute(); 102 | 103 | ``` 104 | 105 | ```javascript 106 | 107 | var myHeaders = new Headers(); 108 | myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM="); 109 | myHeaders.append("Cookie", "JSESSIONID=FD046011463ABEF58A36F3C87DADC88B"); 110 | 111 | var requestOptions = { 112 | method: 'GET', 113 | headers: myHeaders, 114 | redirect: 'follow' 115 | }; 116 | 117 | fetch("/openmrs/ws/rest/v1/conceptclass/8d4907b2-c2cc-11de-8d13-0010c6dffd0f", requestOptions) 118 | .then(response => response.text()) 119 | .then(result => console.log(result)) 120 | .catch(error => console.log('error', error)); 121 | 122 | ``` 123 | 124 | 125 | 126 | * Retrieve a concept class by its UUID. Returns a `404 Not Found` status if concept class type not exists. If user not logged 127 | in to perform this action, a `401 Unauthorized` status returned. 128 | 129 | ## Create a concept class 130 | 131 | > Create a concept class 132 | 133 | ```shell 134 | POST /conceptclass 135 | { 136 | "name": "Procedure", 137 | "description": "Describes a clinical procedure" 138 | } 139 | ``` 140 | ```java 141 | 142 | OkHttpClient client = new OkHttpClient().newBuilder() 143 | .build(); 144 | MediaType mediaType = MediaType.parse("application/json"); 145 | RequestBody body = RequestBody.create(mediaType, "{\r\n \"name\": \"Procedure\",\r\n \"description\": \"Describes a clinical procedure\"\r\n }"); 146 | Request request = new Request.Builder() 147 | .url("/openmrs/ws/rest/v1/conceptclass/") 148 | .method("POST", body) 149 | .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=") 150 | .addHeader("Content-Type", "application/json") 151 | .addHeader("Cookie", "JSESSIONID=FD046011463ABEF58A36F3C87DADC88B") 152 | .build(); 153 | Response response = client.newCall(request).execute(); 154 | 155 | ``` 156 | ```javascript 157 | 158 | var myHeaders = new Headers(); 159 | myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM="); 160 | myHeaders.append("Content-Type", "application/json"); 161 | myHeaders.append("Cookie", "JSESSIONID=FD046011463ABEF58A36F3C87DADC88B"); 162 | 163 | var raw = JSON.stringify({"name":"Procedure","description":"Describes a clinical procedure"}); 164 | 165 | var requestOptions = { 166 | method: 'POST', 167 | headers: myHeaders, 168 | body: raw, 169 | redirect: 'follow' 170 | }; 171 | 172 | fetch("/openmrs/ws/rest/v1/conceptclass/", requestOptions) 173 | .then(response => response.text()) 174 | .then(result => console.log(result)) 175 | .catch(error => console.log('error', error)); 176 | 177 | ``` 178 | 179 | 180 | * To Create a concept class, you need to specify below attributes in the request body. If you are not logged in to perform this action,a `401 Unauthorized` status returned. 181 | * A `400 Bad Request` status is returned if the new concept class name is already used for some other concept class. type 182 | 183 | ### Attributes 184 | 185 | Parameter | Type | Description 186 | --- | --- | --- 187 | *name* | `String` | Name of the concept class (Required) 188 | *description* | `String` | Description 189 | 190 | 191 | ## Update a concept class 192 | 193 | > Update a concept class 194 | 195 | ```shell 196 | POST /conceptclass/:target_concept_class_uuid 197 | { 198 | "name": "Procedure", 199 | "description": "Updating the dummy description" 200 | } 201 | ``` 202 | ```java 203 | 204 | OkHttpClient client = new OkHttpClient().newBuilder() 205 | .build(); 206 | Request request = new Request.Builder() 207 | .url("/openmrs/ws/rest/v1/conceptclass/8afb1247-9c8c-48c4-9253-946ffd44bc8a") 208 | .method("GET", null) 209 | .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=") 210 | .addHeader("Content-Type", "application/json") 211 | .addHeader("Cookie", "JSESSIONID=FD046011463ABEF58A36F3C87DADC88B") 212 | .build(); 213 | Response response = client.newCall(request).execute(); 214 | 215 | ``` 216 | 217 | ```javascript 218 | 219 | var myHeaders = new Headers(); 220 | myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM="); 221 | myHeaders.append("Content-Type", "application/json"); 222 | myHeaders.append("Cookie", "JSESSIONID=FD046011463ABEF58A36F3C87DADC88B"); 223 | 224 | var raw = JSON.stringify({"name":"Procedure","description":"Updating the dummy description"}); 225 | 226 | var requestOptions = { 227 | method: 'GET', 228 | headers: myHeaders, 229 | body: raw, 230 | redirect: 'follow' 231 | }; 232 | 233 | fetch("/openmrs/ws/rest/v1/conceptclass/8afb1247-9c8c-48c4-9253-946ffd44bc8a", requestOptions) 234 | .then(response => response.text()) 235 | .then(result => console.log(result)) 236 | 237 | 238 | ``` 239 | 240 | * Update a target concept class with given UUID, this method only modifies properties in the request. Returns a `404 Not Found` status if concept class not exists. If the user not logged in to perform this action, a `401 Unauthorized` status returned. 241 | 242 | ### Attributes 243 | 244 | Parameter | Type | Description 245 | --- | --- | --- 246 | *name* | `String` | Name of the concept class 247 | *description* | `String` | Description 248 | 249 | 250 | 251 | ## Delete a concept class 252 | 253 | > Delete a concept class 254 | 255 | ```shell 256 | DELETE /conceptclass/:target_concept_class_uuid?purge=true 257 | 258 | ``` 259 | 260 | ```java 261 | 262 | OkHttpClient client = new OkHttpClient().newBuilder() 263 | .build(); 264 | MediaType mediaType = MediaType.parse("text/plain"); 265 | RequestBody body = RequestBody.create(mediaType, ""); 266 | Request request = new Request.Builder() 267 | .url("/openmrs/ws/rest/v1/conceptclass/8afb1247-9c8c-48c4-9253-946ffd44bc8a?purge=true") 268 | .method("DELETE", body) 269 | .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=") 270 | .addHeader("Cookie", "JSESSIONID=FD046011463ABEF58A36F3C87DADC88B") 271 | .build(); 272 | Response response = client.newCall(request).execute(); 273 | 274 | ``` 275 | 276 | ```javascript 277 | 278 | var myHeaders = new Headers(); 279 | myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM="); 280 | myHeaders.append("Cookie", "JSESSIONID=FD046011463ABEF58A36F3C87DADC88B"); 281 | 282 | var requestOptions = { 283 | method: 'DELETE', 284 | headers: myHeaders, 285 | redirect: 'follow' 286 | }; 287 | 288 | fetch("/openmrs/ws/rest/v1/conceptclass/8afb1247-9c8c-48c4-9253-946ffd44bc8a?purge=true", requestOptions) 289 | .then(response => response.text()) 290 | .then(result => console.log(result)) 291 | .catch(error => console.log('error', error)); 292 | 293 | ``` 294 | 295 | 296 | * Delete or Retire a target concept class by its UUID. Returns a `404 Not Found` status if concept class not exists. If the user is not logged in to perform this action, a `401 Unauthorized` status returned. 297 | 298 | ### Query Parameters 299 | 300 | Parameter | Type | Description 301 | --- | --- | --- 302 | *purge* | `Boolean` | The resource will be voided/retired unless purge = ‘true’ 303 | 304 | -------------------------------------------------------------------------------- /source/includes/DatabaseChanges/database_changes.md: -------------------------------------------------------------------------------- 1 | # Database Changes 2 | 3 | ## Database Changes Overview 4 | 5 | Database Change is a Liquibase change set represented by `OpenMRSChangeSet` class. 6 | 7 | ## Available Operations for Database Changes type 8 | 9 | 1. [List Database Changes](#list-database-changes) 10 | 11 | ## List Database Changes 12 | 13 | > List Database Changes 14 | 15 | ```shell 16 | GET /databasechange?v=default 17 | ``` 18 | 19 | ```java 20 | OkHttpClient client = new OkHttpClient().newBuilder() 21 | .build(); 22 | Request request = new Request.Builder() 23 | .url("/openmrs/ws/rest/v1/databasechange?v=default") 24 | .method("GET", null) 25 | .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=") 26 | .addHeader("Cookie", "JSESSIONID=DF385B2E6E39E0BB49BB7E079BF31C44") 27 | .build(); 28 | Response response = client.newCall(request).execute(); 29 | ``` 30 | 31 | ```javascript 32 | var myHeaders = new Headers(); 33 | myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM="); 34 | myHeaders.append("Cookie", "JSESSIONID=DF385B2E6E39E0BB49BB7E079BF31C44"); 35 | 36 | var requestOptions = { 37 | method: 'GET', 38 | headers: myHeaders, 39 | redirect: 'follow' 40 | }; 41 | 42 | fetch("/openmrs/ws/rest/v1/databasechange?v=default", requestOptions) 43 | .then(response => response.text()) 44 | .then(result => console.log(result)) 45 | .catch(error => console.log('error', error)); 46 | ``` 47 | 48 | > Success Response 49 | 50 | ```response 51 | { 52 | "results": [ 53 | { 54 | "uuid": "1227303685425-1", 55 | "display": "ben (generated) createTable tableName=cohort", 56 | "author": "ben (generated)", 57 | "description": "createTable tableName=cohort", 58 | "runStatus": "INVALID_MD5SUM", 59 | "links": [ 60 | { 61 | "rel": "self", 62 | "uri": "http://localhost:8080/openmrs/ws/rest/v1/databasechange/1227303685425-1", 63 | "resourceAlias": "databasechange" 64 | }, 65 | { 66 | "rel": "full", 67 | "uri": "http://localhost:8080/openmrs/ws/rest/v1/databasechange/1227303685425-1?v=full", 68 | "resourceAlias": "databasechange" 69 | } 70 | ], 71 | "resourceVersion": "1.8" 72 | }, 73 | { 74 | "uuid": "1227303685425-2", 75 | "display": "ben (generated) createTable tableName=cohort_member", 76 | "author": "ben (generated)", 77 | "description": "createTable tableName=cohort_member", 78 | "runStatus": "ALREADY_RAN", 79 | "links": [ 80 | { 81 | "rel": "self", 82 | "uri": "http://localhost:8080/openmrs/ws/rest/v1/databasechange/1227303685425-2", 83 | "resourceAlias": "databasechange" 84 | }, 85 | { 86 | "rel": "full", 87 | "uri": "http://localhost:8080/openmrs/ws/rest/v1/databasechange/1227303685425-2?v=full", 88 | "resourceAlias": "databasechange" 89 | } 90 | ], 91 | "resourceVersion": "1.8" 92 | } 93 | ], 94 | "links": [ 95 | { 96 | "rel": "next", 97 | "uri": "http://localhost:8080/openmrs/ws/rest/v1/databasechange?v=default&startIndex=50", 98 | "resourceAlias": null 99 | } 100 | ] 101 | } 102 | ``` 103 | 104 | Fetches all liquibase change sets. Returns a `200 OK` status with the List of DatabaseChange response. 105 | 106 | ## Get Database Change by its Id 107 | 108 | > Get Database Change by its Id 109 | 110 | ```shell 111 | GET /databasechange/:id 112 | ``` 113 | 114 | ```java 115 | OkHttpClient client = new OkHttpClient().newBuilder() 116 | .build(); 117 | Request request = new Request.Builder() 118 | .url("/openmrs/ws/rest/v1/databasechange/:id") 119 | .method("GET", null) 120 | .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=") 121 | .addHeader("Cookie", "JSESSIONID=DF385B2E6E39E0BB49BB7E079BF31C44") 122 | .build(); 123 | Response response = client.newCall(request).execute(); 124 | ``` 125 | 126 | ```javascript 127 | var myHeaders = new Headers(); 128 | myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM="); 129 | myHeaders.append("Cookie", "JSESSIONID=DF385B2E6E39E0BB49BB7E079BF31C44"); 130 | 131 | var requestOptions = { 132 | method: 'GET', 133 | headers: myHeaders, 134 | redirect: 'follow' 135 | }; 136 | 137 | fetch("/openmrs/ws/rest/v1/databasechange/:id", requestOptions) 138 | .then(response => response.text()) 139 | .then(result => console.log(result)) 140 | .catch(error => console.log('error', error)); 141 | ``` 142 | 143 | > Success Response 144 | 145 | ```response 146 | { 147 | "uuid": "1227303685425-34", 148 | "display": "ben (generated) createTable tableName=hl7_in_error", 149 | "author": "ben (generated)", 150 | "description": "createTable tableName=hl7_in_error", 151 | "runStatus": "INVALID_MD5SUM", 152 | "links": [ 153 | { 154 | "rel": "self", 155 | "uri": "http://localhost:8080/openmrs/ws/rest/v1/databasechange/1227303685425-34", 156 | "resourceAlias": "databasechange" 157 | }, 158 | { 159 | "rel": "full", 160 | "uri": "http://localhost:8080/openmrs/ws/rest/v1/databasechange/1227303685425-34?v=full", 161 | "resourceAlias": "databasechange" 162 | } 163 | ], 164 | "resourceVersion": "1.8" 165 | } 166 | ``` 167 | 168 | Fetches Liquibase change set by its id. Returns a `404 Not Found` status if the change set does not exist. If the user is not logged in to perform this action, a `401 Unauthorized` status is returned. 169 | -------------------------------------------------------------------------------- /source/includes/Drugs/drugs.md: -------------------------------------------------------------------------------- 1 | # Drugs 2 | 3 | ## Available operations for Drugs 4 | 5 | 1. [List drugs](#list-drugs) 6 | 2. [Create a drug](#create-a-drug) 7 | 3. [Update a drug](#update-a-drug) 8 | 4. [Delete a drug](#delete-a-drug) 9 | 10 | 11 | ## List drugs 12 | 13 | > List drugs 14 | 15 | ```shell 16 | GET /drug 17 | ``` 18 | 19 | ```java 20 | OkHttpClient client = new OkHttpClient().newBuilder() 21 | .build(); 22 | Request request = new Request.Builder() 23 | .url("/openmrs/ws/rest/v1/drug") 24 | .method("GET", null) 25 | .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=") 26 | .addHeader("Cookie", "JSESSIONID=A2AF09658C73E1ECEC5D3C8C7C249A2D") 27 | .build(); 28 | Response response = client.newCall(request).execute(); 29 | ``` 30 | 31 | ```javascript 32 | var requestHeaders = new Headers(); 33 | requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM="); 34 | requestHeaders.append("Cookie", "JSESSIONID=A2AF09658C73E1ECEC5D3C8C7C249A2D"); 35 | 36 | var requestOptions = { 37 | method: 'GET', 38 | headers: requestHeaders, 39 | redirect: 'follow' 40 | }; 41 | 42 | fetch("/openmrs/ws/rest/v1/drug", requestOptions) 43 | .then(response => response.text()) 44 | .then(result => console.log(result)) 45 | .catch(error => console.log('error', error)); 46 | ``` 47 | 48 | 49 | > Success Response 50 | 51 | ```response 52 | { 53 | "results": [ 54 | { 55 | "display": "test", 56 | "uuid": "1d0050db-bd0b-42fb-9e60-cd50c177e922", 57 | "name": "test", 58 | "description": null, 59 | "retired": false, 60 | "dosageForm": null, 61 | "maximumDailyDose": null, 62 | "minimumDailyDose": null, 63 | "concept": { 64 | "uuid": "08e5f67d-b63e-4f99-a09b-e6193125cf77", 65 | "display": "drug test", 66 | "links": [ 67 | { 68 | "rel": "self", 69 | "uri": "http://localhost:8080/openmrs/ws/rest/v1/concept/08e5f67d-b63e-4f99-a09b-e6193125cf77", 70 | "resourceAlias": "concept" 71 | } 72 | ] 73 | }, 74 | "combination": false, 75 | "strength": null, 76 | "drugReferenceMaps": [], 77 | "ingredients": [], 78 | "links": [ 79 | { 80 | "rel": "self", 81 | "uri": "http://localhost:8080/openmrs/ws/rest/v1/drug/1d0050db-bd0b-42fb-9e60-cd50c177e922", 82 | "resourceAlias": "drug" 83 | }, 84 | { 85 | "rel": "full", 86 | "uri": "http://localhost:8080/openmrs/ws/rest/v1/drug/1d0050db-bd0b-42fb-9e60-cd50c177e922?v=full", 87 | "resourceAlias": "drug" 88 | } 89 | ], 90 | "resourceVersion": "1.12" 91 | } 92 | ] 93 | } 94 | ``` 95 | 96 | 97 | Quickly filter drugs with given query parameters. Add parameter `includeAll=true` to also retrieve retired drugs. 98 | If not logged in to perform this action, a `401 Unauthorized` status is returned. 99 | 100 | 101 | ### Query Parameters 102 | 103 | | Parameter | Type | Description | 104 | | ------------ | ---------------| ------------------------------------- | 105 | | _q_ | `Search Query` | Filter drugs by their name | 106 | | _includeAll_ | `Boolean` | If true, returns also retired drugs | 107 | 108 | 109 | ## Get a drug by UUID. 110 | 111 | > Get a drug by UUID 112 | 113 | ```shell 114 | GET /drug/:uuid 115 | ``` 116 | 117 | ```java 118 | OkHttpClient client = new OkHttpClient().newBuilder() 119 | .build(); 120 | Request request = new Request.Builder() 121 | .url("/openmrs/ws/rest/v1/drug/:uuid") 122 | .method("GET", null) 123 | .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=") 124 | .addHeader("Cookie", "JSESSIONID=A2AF09658C73E1ECEC5D3C8C7C249A2D") 125 | .build(); 126 | Response response = client.newCall(request).execute(); 127 | ``` 128 | 129 | ```javascript 130 | var myHeaders = new Headers(); 131 | myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM="); 132 | myHeaders.append("Cookie", "JSESSIONID=DF385B2E6E39E0BB49BB7E079BF31C44"); 133 | 134 | var requestOptions = { 135 | method: 'GET', 136 | headers: myHeaders, 137 | redirect: 'follow' 138 | }; 139 | 140 | fetch("/openmrs/ws/rest/v1/drug/:uuid", requestOptions) 141 | .then(response => response.text()) 142 | .then(result => console.log(result)) 143 | .catch(error => console.log('error', error)); 144 | ``` 145 | 146 | * Retrieve a drug by its UUID. Returns a `404 Not Found` status if the drug does not exist. If not logged in to perform this action, a `401 Unauthorized` status is returned. 147 | 148 | 149 | ## Create a drug 150 | 151 | > Create a drug 152 | 153 | ```shell 154 | { 155 | "concept": "08e5f67d-b63e-4f99-a09b-e6193125cf77", 156 | "combination": true, 157 | "name": "drug name", 158 | "minimumDailyDose": 1, 159 | "maximumDailyDose": 5, 160 | "dosageForm": "08e5f67d-b63e-4f99-a09b-e6193125cf77" 161 | } 162 | ``` 163 | 164 | ```java 165 | OkHttpClient client = new OkHttpClient().newBuilder() 166 | .build(); 167 | MediaType mediaType = MediaType.parse("application/json"); 168 | RequestBody body = RequestBody.create(mediaType, "{\"concept\": \"08e5f67d-b63e-4f99-a09b-e6193125cf77\",\"combination\": true,\"name\": \"drug name\",\"minimumDailyDose\": 1,\"maximumDailyDose\": 5,\"dosageForm\": \"08e5f67d-b63e-4f99-a09b-e6193125cf77\"}"); 169 | Request request = new Request.Builder() 170 | .url("/openmrs/ws/rest/v1/drug") 171 | .method("POST", body) 172 | .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=") 173 | .addHeader("Content-Type", "application/json") 174 | .addHeader("Cookie", "JSESSIONID=DF385B2E6E39E0BB49BB7E079BF31C44") 175 | .build(); 176 | Response response = client.newCall(request).execute(); 177 | ``` 178 | 179 | ```javascript 180 | var myHeaders = new Headers(); 181 | myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM="); 182 | myHeaders.append("Content-Type", "application/json"); 183 | myHeaders.append("Cookie", "JSESSIONID=DF385B2E6E39E0BB49BB7E079BF31C44"); 184 | 185 | var raw = JSON.stringify({"concept": "08e5f67d-b63e-4f99-a09b-e6193125cf77","combination": true,"name": "drug name","minimumDailyDose": 1,"maximumDailyDose": 5,"dosageForm": "08e5f67d-b63e-4f99-a09b-e6193125cf77"}); 186 | 187 | var requestOptions = { 188 | method: 'POST', 189 | headers: myHeaders, 190 | body: raw, 191 | redirect: 'follow' 192 | }; 193 | 194 | fetch("/openmrs/ws/rest/v1/drug", requestOptions) 195 | .then(response => response.text()) 196 | .then(result => console.log(result)) 197 | .catch(error => console.log('error', error)); 198 | ``` 199 | 200 | To create a drug you need to specify below properties in your request body. 201 | If the user is not logged in to perform this action, a `401 Unauthorized` status returned. 202 | 203 | ### Attributes 204 | 205 | Parameter | Type | Description 206 | --- | --- | --- 207 | *concept* | `Concept_UUID` | Concept describing this drug 208 | *combination* | `Boolean` | Is this drug a combination 209 | *name* | `String` | Name of a drug 210 | *minimumDailyDose* | `Double` | Minimum drug daily dose 211 | *maximumDailyDose* | `Double` | Maximum drug daily dose 212 | *dosageForm* | `Concept_UUID` | Concept describing dosage form of this drug 213 | 214 | 215 | ## Update a drug 216 | 217 | > Update a drug by its UUID 218 | 219 | ```shell 220 | { 221 | "concept": "08e5f67d-b63e-4f99-a09b-e6193125cf77", 222 | "combination": true, 223 | "name": "drug name", 224 | "minimumDailyDose": 1, 225 | "maximumDailyDose": 5, 226 | "dosageForm": "08e5f67d-b63e-4f99-a09b-e6193125cf77" 227 | } 228 | ``` 229 | 230 | ```java 231 | OkHttpClient client = new OkHttpClient().newBuilder() 232 | .build(); 233 | MediaType mediaType = MediaType.parse("application/json"); 234 | RequestBody body = RequestBody.create(mediaType, "{\"concept\": \"08e5f67d-b63e-4f99-a09b-e6193125cf77\",\"combination\": true,\"name\": \"drug name\",\"minimumDailyDose\": 1,\"maximumDailyDose\": 5,\"dosageForm\": \"08e5f67d-b63e-4f99-a09b-e6193125cf77\"}"); 235 | Request request = new Request.Builder() 236 | .url("/openmrs/ws/rest/v1/drug/:uuid") 237 | .method("POST", body) 238 | .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=") 239 | .addHeader("Content-Type", "application/json") 240 | .addHeader("Cookie", "JSESSIONID=DF385B2E6E39E0BB49BB7E079BF31C44") 241 | .build(); 242 | Response response = client.newCall(request).execute(); 243 | ``` 244 | 245 | ```javascript 246 | var myHeaders = new Headers(); 247 | myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM="); 248 | myHeaders.append("Content-Type", "application/json"); 249 | myHeaders.append("Cookie", "JSESSIONID=DF385B2E6E39E0BB49BB7E079BF31C44"); 250 | 251 | var raw = JSON.stringify({"concept": "08e5f67d-b63e-4f99-a09b-e6193125cf77","combination": true,"name": "drug name","minimumDailyDose": 1,"maximumDailyDose": 5,"dosageForm": "08e5f67d-b63e-4f99-a09b-e6193125cf77"}); 252 | 253 | var requestOptions = { 254 | method: 'POST', 255 | headers: myHeaders, 256 | body: raw, 257 | redirect: 'follow' 258 | }; 259 | 260 | fetch("/openmrs/ws/rest/v1/drug/:uuid", requestOptions) 261 | .then(response => response.text()) 262 | .then(result => console.log(result)) 263 | .catch(error => console.log('error', error)); 264 | ``` 265 | 266 | To update a drug you need to specify below properties in your request body. 267 | If the user is not logged in to perform this action, a `401 Unauthorized` status returned. 268 | 269 | ### Attributes 270 | 271 | Parameter | Type | Description 272 | --- | --- | --- 273 | *concept* | `Concept_UUID` | Concept describing this drug 274 | *combination* | `Boolean` | Is this drug a combination 275 | *name* | `String` | Name of a drug 276 | *minimumDailyDose* | `Double` | Minimum drug daily dose 277 | *maximumDailyDose* | `Double` | Maximum drug daily dose 278 | *dosageForm* | `Concept_UUID` | Concept describing dosage form of this drug 279 | 280 | 281 | 282 | ## Delete a drug 283 | 284 | > Delete a drug by its UUID 285 | 286 | ```shell 287 | DELETE /drug/:uuid?purge=true 288 | ``` 289 | ```java 290 | 291 | OkHttpClient client = new OkHttpClient().newBuilder() 292 | .build(); 293 | MediaType mediaType = MediaType.parse("text/plain"); 294 | RequestBody body = RequestBody.create(mediaType, ""); 295 | Request request = new Request.Builder() 296 | .url("/openmrs/ws/rest/v1/drug/:uuid?purge=true") 297 | .method("DELETE", body) 298 | .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=") 299 | .addHeader("Cookie", "JSESSIONID=154692F02BBBC664825F3C4C224A474B") 300 | .build(); 301 | Response response = client.newCall(request).execute(); 302 | 303 | ``` 304 | 305 | ```javascript 306 | 307 | var requestHeaders = new Headers(); 308 | requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM="); 309 | requestHeaders.append("Cookie", "JSESSIONID=955E778A4F700C5AA9651DAF6FC9DDDA"); 310 | 311 | var requestOptions = { 312 | method: 'DELETE', 313 | headers: requestHeaders, 314 | redirect: 'follow' 315 | }; 316 | 317 | fetch("https://demo.openmrs.org/openmrs/ws/rest/v1/drug/:uuid?purge=true", requestOptions) 318 | .then(response => response.text()) 319 | .then(result => console.log(result)) 320 | .catch(error => console.log('error', error)); 321 | 322 | ``` 323 | 324 | 325 | Delete or retire a drug by its UUID. Returns a `404 Not Found` status if the drug does not exist. If not logged in to perform this action, a `401 Unauthorized` status is returned. 326 | 327 | ### Query Parameters 328 | 329 | | Parameter | Type | Description | 330 | | --------- | --------- | ------------------------------------------------- | 331 | | _purge_ | `Boolean` | The resource will be retired unless purge = ‘true’ | 332 | 333 | -------------------------------------------------------------------------------- /source/includes/EmrApi/emrapi_configuration.md: -------------------------------------------------------------------------------- 1 | # EMRAPI Configuration 2 | 3 | ## EMR API Configuration Overview 4 | 5 | The EMR API module provides several high-level APIs and configuration settings. The configuration endpoint provided by the `emrapi` module enables RESTful access to these configuration values. 6 | 7 | ## Available operations for EMRAPI Configuration 8 | 9 | 1. [Get EMRAPI Configuration](#get-emrapi-configuration) 10 | 11 | ## Get EMRAPI Configuration 12 | 13 | > Get EMRAPI configuration 14 | 15 | ```shell 16 | GET /openmrs/ws/rest/v1/emrapi/configuration 17 | ``` 18 | 19 | ```java 20 | 21 | OkHttpClient client = new OkHttpClient().newBuilder() 22 | .build(); 23 | Request request = new Request.Builder() 24 | .url("/openmrs/ws/rest/v1/emrapi/configuration") 25 | .method("GET", null) 26 | .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=") 27 | .addHeader("Cookie", "JSESSIONID=33B84B3BEA8E81E9D22D5A722815E010") 28 | .build(); 29 | Response response = client.newCall(request).execute(); 30 | ``` 31 | 32 | ```javascript 33 | 34 | var requestHeaders = new Headers(); 35 | requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM="); 36 | requestHeaders.append("Cookie", "JSESSIONID=33B84B3BEA8E81E9D22D5A722815E010"); 37 | 38 | var requestOptions = { 39 | method: 'GET', 40 | headers: requestHeaders, 41 | redirect: 'follow' 42 | }; 43 | 44 | fetch("/openmrs/ws/rest/v1/emrapi/configuration", requestOptions) 45 | .then(response => response.text()) 46 | .then(result => console.log(result)) 47 | .catch(error => console.log('error', error)); 48 | ``` 49 | 50 | > Success Response 51 | 52 | ```response 53 | { 54 | "metadataSourceName": string, 55 | "orderingProviderEncounterRole": encounterRole, 56 | "supportsTransferLocationTag": locationTag, 57 | "unknownLocation": location, 58 | "denyAdmissionConcept": concept, 59 | "admissionForm": form, 60 | "exitFromInpatientEncounterType": encounterType, 61 | "extraPatientIdentifierTypes": patientIdentifierType[], 62 | "consultFreeTextCommentsConcept": concept, 63 | "sameAsConceptMapType": conceptMapType, 64 | "testPatientPersonAttributeType": personAttributeType, 65 | "admissionDecisionConcept": concept, 66 | "supportsAdmissionLocationTag": locationTag, 67 | "checkInEncounterType": encounterType, 68 | "transferWithinHospitalEncounterType": encounterType, 69 | "suppressedDiagnosisConcepts": concept[], 70 | "primaryIdentifierType": patientIdentifierType, 71 | "nonDiagnosisConceptSets": concept[], 72 | "fullPrivilegeLevel": role, 73 | "unknownProvider": provider, 74 | "diagnosisSets": concept[], 75 | "personImageDirectory": string, 76 | "visitNoteEncounterType": encounterType, 77 | "consultEncounterType": encounterType, 78 | "diagnosisMetadata": { 79 | "diagnosisCertaintyConcept": concept, 80 | "diagnosisOrderConcept": concept, 81 | "codedDiagnosisConcept": concept, 82 | "nonCodedDiagnosisConcept": concept, 83 | "diagnosisSetConcept": concept 84 | }, 85 | "narrowerThanConceptMapType": conceptMapType, 86 | "clinicianEncounterRole": encounterRole, 87 | "conceptSourcesForDiagnosisSearch": conceptSource[], 88 | "patientDiedConcept": concept, 89 | "emrApiConceptSource": conceptSource, 90 | "lastViewedPatientSizeLimit": integer, 91 | "identifierTypesToSearch": patientIdentifierType[], 92 | "telephoneAttributeType": personAttributeType, 93 | "checkInClerkEncounterRole": encounterRole, 94 | "dischargeForm": form, 95 | "unknownCauseOfDeathConcept": concept, 96 | "visitAssignmentHandlerAdjustEncounterTimeOfDayIfNecessary": boolean, 97 | "atFacilityVisitType": visitType, 98 | "visitExpireHours": integer, 99 | "admissionEncounterType": encounterType, 100 | "dispositions": [ 101 | { 102 | "uuid": string, 103 | "name": string, 104 | "conceptCode": string, 105 | "type: string, 106 | "careSettingTypes": string[], 107 | "encounterTypes": string[], 108 | "excludedEncounterTypes": string[], 109 | "keepsVisitOpen": boolean, 110 | "actions": string[], 111 | "additionalObs": [ 112 | { 113 | "label": string, 114 | "conceptCode: string, 115 | "params: map 116 | } 117 | ], 118 | } 119 | ], 120 | "dispositionDescriptor": { 121 | "admissionLocationConcept": concept, 122 | "dateOfDeathConcept": concept, 123 | "dispositionConcept": concept, 124 | "internalTransferLocationConcept": concept, 125 | "dispositionSetConcept": concept 126 | }, 127 | "highPrivilegeLevel": role, 128 | "supportsLoginLocationTag": locationTag, 129 | "unknownPatientPersonAttributeType": personAttributeType, 130 | "supportsVisitsLocationTag": locationTag, 131 | "transferForm": form 132 | } 133 | ``` 134 | 135 | ### Supported Parameters: 136 | 137 | * `v`: optional, defaults to `ref`. This allows specifying the desired representation of ref | default | full | custom 138 | 139 | The endpoint supports all standard representations (ref, default, full, and custom). If no representation is specified, the `ref` is returned. 140 | For any given representation, all properties are returned with the given representation. 141 | A custom representation can be used to retrieve only specific properties of interest, and specific data within those representations. 142 | -------------------------------------------------------------------------------- /source/includes/EmrApi/inpatient_admission.md: -------------------------------------------------------------------------------- 1 | # Inpatient Admission 2 | 3 | ## Overview 4 | Provides a means to retrieve inpatient admissions associated with active visits that meet the given request criteria. 5 | 6 | ## Available operations for Inpatient Admission 7 | 8 | 1. [Get Inpatient Admission](#get-inpatient-admission) 9 | 10 | ## Get Inpatient Admission 11 | 12 | > Get Inpatient Admission 13 | 14 | ```shell 15 | GET /openmrs/ws/rest/v1/emrapi/inpatient/admission?visitLocation=b6fcd85f-5995-43c9-875f-3bb2299087ff&totalCount=true 16 | ``` 17 | 18 | ```java 19 | 20 | OkHttpClient client = new OkHttpClient().newBuilder() 21 | .build(); 22 | Request request = new Request.Builder() 23 | .url("/openmrs/ws/rest/v1/emrapi/inpatient/admission?visitLocation=b6fcd85f-5995-43c9-875f-3bb2299087ff&totalCount=true") 24 | .method("GET", null) 25 | .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=") 26 | .addHeader("Cookie", "JSESSIONID=33B84B3BEA8E81E9D22D5A722815E010") 27 | .build(); 28 | Response response = client.newCall(request).execute(); 29 | 30 | ``` 31 | 32 | ```javascript 33 | 34 | var requestHeaders = new Headers(); 35 | requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM="); 36 | requestHeaders.append("Cookie", "JSESSIONID=33B84B3BEA8E81E9D22D5A722815E010"); 37 | 38 | var requestOptions = { 39 | method: 'GET', 40 | headers: requestHeaders, 41 | redirect: 'follow' 42 | }; 43 | 44 | fetch("/openmrs/ws/rest/v1/emrapi/inpatient/admission?visitLocation=b6fcd85f-5995-43c9-875f-3bb2299087ff&totalCount=true", requestOptions) 45 | .then(response => response.text()) 46 | .then(result => console.log(result)) 47 | .catch(error => console.log('error', error)); 48 | 49 | ``` 50 | 51 | > Success Response 52 | 53 | ```response 54 | 55 | { 56 | "results": [ 57 | { 58 | "visit": visit, 59 | "patient": patient, 60 | "currentInpatientLocation": location, 61 | "adtEncounters": encounter[], 62 | "admissionEncounters": encounter[], 63 | "transferEncounters": encounter[], 64 | "dischargeEncounters": encounter[], 65 | "latestAdtEncounter": encounter, 66 | "admissionAndTransferEncounters": encounter[], 67 | "firstAdmissionOrTransferEncounter": encounter, 68 | "latestAdmissionOrTransferEncounter": encounter, 69 | "encounterAssigningToCurrentInpatientLocation": encounter, 70 | "discharged": boolean 71 | } 72 | ], 73 | "totalCount": integer 74 | } 75 | ``` 76 | 77 | This endpoint returns paged data. The maximum number of results for any paged response is controlled by the webservices.rest module configuration. 78 | 79 | ### Supported Parameters: 80 | 81 | * `visitLocation`: optional location uuid. If specified, limits the admissions to those associated with a visit at the given location or parent visit location 82 | * `currentInpatientLocation`: optional list of location uuids. If specified, limits the admissions to those where the patient is currently at one of the given locations 83 | * `includeDischarged`: optional, defaults to false. If true, includes patients who have active visits but whose most recent ADT encounter is a discharge 84 | * `totalCount`: optional, defaults to false. This is a standard REST parameter which, if passed with `true`, will included a `totalCount` property in the response. 85 | * `v`: optional, defaults to `default`. This allows specifying the desired representation of ref | default | full | custom 86 | 87 | ### Available representations 88 | 89 | #### Full representation: 90 | 91 | * visit: full 92 | * all other properties: default 93 | 94 | #### Default Representation: 95 | 96 | * visit: default 97 | * currentInpatientLocation: ref, 98 | * firstAdmissionOrTransferEncounter: custom:(uuid,display,encounterDatetime,location:ref,encounterType:ref), 99 | * latestAdmissionOrTransferEncounter: custom:(uuid,display,encounterDatetime,location:ref,encounterType:ref), 100 | * encounterAssigningToCurrentInpatientLocation: custom:(uuid,display,encounterDatetime,location:ref,encounterType:ref), 101 | * discharged: default 102 | 103 | #### Ref Representation 104 | 105 | All properties returned as `ref` representations 106 | 107 | #### Custom Representation 108 | 109 | Any custom representation is supported. -------------------------------------------------------------------------------- /source/includes/EmrApi/inpatient_request.md: -------------------------------------------------------------------------------- 1 | # Inpatient Request 2 | 3 | ## Overview 4 | Provides a means to retrieve inpatient requests (eg. requests for admission, discharge, or transfer) associated with active visits that meet the given request criteria. 5 | 6 | ## Available operations for Inpatient Request 7 | 8 | 1. [Get Inpatient Request](#get-inpatient-request) 9 | 10 | ## Get Inpatient Request 11 | 12 | > Get Inpatient Request 13 | 14 | ```shell 15 | GET /openmrs/ws/rest/v1/emrapi/inpatient/inpatient/request?dispositionType=ADMIT&visitLocation=b6fcd85f-5995-43c9-875f-3bb2299087ff&dispositionLocation=b6fcd85f-5995-43c9-875f-3bb2299087ff&totalCount=true&v=full 16 | ``` 17 | 18 | ```java 19 | 20 | OkHttpClient client = new OkHttpClient().newBuilder() 21 | .build(); 22 | Request request = new Request.Builder() 23 | .url("/openmrs/ws/rest/v1/emrapi/inpatient/inpatient/request?dispositionType=ADMIT&visitLocation=b6fcd85f-5995-43c9-875f-3bb2299087ff&dispositionLocation=b6fcd85f-5995-43c9-875f-3bb2299087ff&totalCount=true&v=full") 24 | .method("GET", null) 25 | .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=") 26 | .addHeader("Cookie", "JSESSIONID=33B84B3BEA8E81E9D22D5A722815E010") 27 | .build(); 28 | Response response = client.newCall(request).execute(); 29 | 30 | ``` 31 | 32 | ```javascript 33 | 34 | var requestHeaders = new Headers(); 35 | requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM="); 36 | requestHeaders.append("Cookie", "JSESSIONID=33B84B3BEA8E81E9D22D5A722815E010"); 37 | 38 | var requestOptions = { 39 | method: 'GET', 40 | headers: requestHeaders, 41 | redirect: 'follow' 42 | }; 43 | 44 | fetch("/openmrs/ws/rest/v1/emrapi/inpatient/inpatient/request?dispositionType=ADMIT&visitLocation=b6fcd85f-5995-43c9-875f-3bb2299087ff&dispositionLocation=b6fcd85f-5995-43c9-875f-3bb2299087ff&totalCount=true&v=full", requestOptions) 45 | .then(response => response.text()) 46 | .then(result => console.log(result)) 47 | .catch(error => console.log('error', error)); 48 | 49 | ``` 50 | 51 | > Success Response 52 | 53 | ```response 54 | 55 | { 56 | "results": [ 57 | { 58 | "visit": visit, 59 | "patient": patient, 60 | "dispositionType": ADMIT | TRANSFER | DISCHARGE, 61 | "dispositionEncounter": encounter, 62 | "dispositionObsGroup": obs, 63 | "disposition": concept, 64 | "dispositionLocation": location 65 | } 66 | ], 67 | "totalCount": integer 68 | } 69 | ``` 70 | 71 | This endpoint returns paged data. The maximum number of results for any paged response is controlled by the webservices.rest module configuration. 72 | 73 | ### Supported Parameters: 74 | 75 | * `visitLocation`: optional location uuid. If specified, limits the requests to those associated with a visit at the given location or parent visit location 76 | * `dispositionLocation`: optional list of location uuids. If specified, limits the requests to those requesting one of the specified locations 77 | * `dispositionType`: optional list of `ADMIT`, `TRANSFER` OR `DISCHAGE` allows indicating with specific types of requests should be returned 78 | * `totalCount`: optional, defaults to false. This is a standard REST parameter which, if passed with `true`, will included a `totalCount` property in the response. 79 | * `v`: optional, defaults to `default`. This allows specifying the desired representation of ref | default | full | custom 80 | 81 | ### Available representations 82 | 83 | #### Full representation: 84 | 85 | * visit: `full` 86 | * all other properties: `default` 87 | 88 | #### Default Representation: 89 | 90 | * visit: `default` 91 | * all other properties: `ref` 92 | 93 | #### Ref Representation 94 | 95 | All properties returned as `ref` representations 96 | 97 | #### Custom Representation 98 | 99 | Any custom representation is supported. -------------------------------------------------------------------------------- /source/includes/Encounter/encounter_role.md: -------------------------------------------------------------------------------- 1 | # Encounter Role 2 | 3 | ## Encounter Role Overview 4 | 5 | * An Encounter role is specific to the [encounter](#encounters). While these could match up to existing organizational roles (e.g., "Nurse"), they don't have to (e.g., "Lead Surgeon"). 6 | 7 | ## Available operation for Encounter Roles 8 | 9 | 1. [List encounter roles](#list-encounter-roles) 10 | 2. [Create an encounter role](#create-a-encounter-role) 11 | 3. [Update an encounter role](#update-a-encounters-role) 12 | 4. [Delete an encounter role](#delete-a-encounters-role) 13 | 14 | 15 | ## List encounter roles 16 | 17 | > List encounter roles 18 | 19 | ```shell 20 | GET /encounterrole?q=Clinician&v=full 21 | ``` 22 | 23 | ```java 24 | 25 | OkHttpClient client = new OkHttpClient().newBuilder() 26 | .build(); 27 | Request request = new Request.Builder() 28 | .url("/openmrs/ws/rest/v1/encounterrole?q=Clinician&v=full") 29 | .method("GET", null) 30 | .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=") 31 | .addHeader("Cookie", "JSESSIONID=299EEB7913BE50BACA8D795EBE6D0094") 32 | .build(); 33 | Response response = client.newCall(request).execute(); 34 | 35 | ``` 36 | 37 | 38 | ```javascript 39 | 40 | var requestHeaders = new Headers(); 41 | requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM="); 42 | requestHeaders.append("Cookie", "JSESSIONID=299EEB7913BE50BACA8D795EBE6D0094"); 43 | 44 | var requestOptions = { 45 | method: 'GET', 46 | headers: requestHeaders, 47 | redirect: 'follow' 48 | }; 49 | 50 | fetch("/openmrs/ws/rest/v1/encounterrole?q=Clinician&v=full", requestOptions) 51 | .then(response => response.text()) 52 | .then(result => console.log(result)) 53 | .catch(error => console.log('error', error)); 54 | 55 | ``` 56 | 57 | > Success Response 58 | 59 | ```response 60 | 61 | { 62 | "results": [ 63 | { 64 | "uuid": "240b26f9-dd88-4172-823d-4a8bfeb7841f", 65 | "display": "Clinician", 66 | "name": "Clinician", 67 | "description": "Doctor or Nurse who is the primary provider for an encounter, and will sign the note", 68 | "retired": false, 69 | "auditInfo": { 70 | "creator": { 71 | "uuid": "A4F30A1B-5EB9-11DF-A648-37A07F9C90FB", 72 | "display": "daemon", 73 | "links": [ 74 | { 75 | "rel": "self", 76 | "uri": "http://qa-refapp.openmrs.org/openmrs/ws/rest/v1/user/A4F30A1B-5EB9-11DF-A648-37A07F9C90FB" 77 | } 78 | ] 79 | }, 80 | "dateCreated": "2013-08-02T05:20:48.000+0000", 81 | "changedBy": null, 82 | "dateChanged": null 83 | }, 84 | "links": [ 85 | { 86 | "rel": "self", 87 | "uri": "http://qa-refapp.openmrs.org/openmrs/ws/rest/v1/encounterrole/240b26f9-dd88-4172-823d-4a8bfeb7841f" 88 | } 89 | ], 90 | "resourceVersion": "1.8" 91 | } 92 | ] 93 | } 94 | 95 | ``` 96 | 97 | * Quickly filter encounter roles with given query parameters. Returns a `404 Not Found` status if encounter roles not exist. If the user is not logged in to perform this action, a `401 Unauthorized` status returned. 98 | 99 | ### Query Parameters 100 | 101 | Parameter | Type | Description 102 | --- | --- | --- 103 | *q* | `Search Query` | Query to filter encounter role by its name 104 | 105 | 106 | ## Get encounter role by UUID. 107 | 108 | > Get encounter role by UUID 109 | 110 | ```shell 111 | GET /encounter/:target_encounter_role_uuid 112 | ``` 113 | 114 | ```java 115 | 116 | OkHttpClient client = new OkHttpClient().newBuilder() 117 | .build(); 118 | Request request = new Request.Builder() 119 | .url("/openmrs/ws/rest/v1/encounterrole/240b26f9-dd88-4172-823d-4a8bfeb7841f") 120 | .method("GET", null) 121 | .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=") 122 | .addHeader("Cookie", "JSESSIONID=299EEB7913BE50BACA8D795EBE6D0094") 123 | .build(); 124 | Response response = client.newCall(request).execute(); 125 | 126 | ``` 127 | 128 | ```javascript 129 | 130 | var requestHeaders = new Headers(); 131 | requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM="); 132 | requestHeaders.append("Cookie", "JSESSIONID=299EEB7913BE50BACA8D795EBE6D0094"); 133 | 134 | var requestOptions = { 135 | method: 'GET', 136 | headers: requestHeaders, 137 | redirect: 'follow' 138 | }; 139 | 140 | fetch("/openmrs/ws/rest/v1/encounterrole/240b26f9-dd88-4172-823d-4a8bfeb7841f", requestOptions) 141 | .then(response => response.text()) 142 | .then(result => console.log(result)) 143 | .catch(error => console.log('error', error)); 144 | 145 | ``` 146 | 147 | * Retrieve an encounter role by its UUID. Returns a `404 Not Found` status if encounter role not exists. If user not logged in to perform this action, a `401 Unauthorized` status returned. 148 | 149 | 150 | ## Create an encounter role 151 | 152 | > Create an encounter role 153 | 154 | ```shell 155 | POST /encounterrole 156 | { 157 | "name": "Clinician", 158 | "description": "A provider assisting the Lead Surgeon." 159 | } 160 | ``` 161 | 162 | ```java 163 | OkHttpClient client = new OkHttpClient().newBuilder() 164 | .build(); 165 | MediaType mediaType = MediaType.parse("application/json"); 166 | RequestBody body = RequestBody.create(mediaType, "{\r\n \"name\": \"Clinician\",\r\n \"description\": \"A provider assisting the Lead Surgeon.\"\r\n}"); 167 | Request request = new Request.Builder() 168 | .url("/openmrs/ws/rest/v1/encounterrole") 169 | .method("POST", body) 170 | .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=") 171 | .addHeader("Content-Type", "application/json") 172 | .addHeader("Cookie", "JSESSIONID=299EEB7913BE50BACA8D795EBE6D0094") 173 | .build(); 174 | Response response = client.newCall(request).execute(); 175 | 176 | ``` 177 | 178 | ```javascript 179 | 180 | var requestHeaders = new Headers(); 181 | requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM="); 182 | requestHeaders.append("Content-Type", "application/json"); 183 | requestHeaders.append("Cookie", "JSESSIONID=299EEB7913BE50BACA8D795EBE6D0094"); 184 | 185 | var raw = JSON.stringify({"name":"Clinician","description":"A provider assisting the Lead Surgeon."}); 186 | 187 | var requestOptions = { 188 | method: 'POST', 189 | headers: requestHeaders, 190 | body: raw, 191 | redirect: 'follow' 192 | }; 193 | 194 | fetch("/openmrs/ws/rest/v1/encounterrole", requestOptions) 195 | .then(response => response.text()) 196 | .then(result => console.log(result)) 197 | .catch(error => console.log('error', error)); 198 | 199 | ``` 200 | 201 | * To Create an encounter role, you need to specify below attributes in the request body. If you are not logged in to perform this action, a `401 Unauthorized` status returned. 202 | * If the name is already in use then a `400 Bad Request ` status is returned. 203 | 204 | ### Attributes 205 | 206 | Parameter | Type | Description 207 | --- | --- | --- 208 | *name* | `String` | Name for the encounter role (required) 209 | *description* | `String | Description for the encounter role (required) 210 | 211 | 212 | ## Update an encounter role 213 | 214 | > Update an encounter role 215 | 216 | ```shell 217 | POST /encounterrole/:target_encounter_role_uuid 218 | { 219 | "description": "A surgeon who assisted the Lead Surgeon" 220 | } 221 | ``` 222 | 223 | ```java 224 | 225 | OkHttpClient client = new OkHttpClient().newBuilder() 226 | .build(); 227 | MediaType mediaType = MediaType.parse("application/json"); 228 | RequestBody body = RequestBody.create(mediaType, "{\r\n \"description\": \"A surgeon who assisted the Lead Surgeon\"\r\n}\r\n"); 229 | Request request = new Request.Builder() 230 | .url("/openmrs/ws/rest/v1/encounterrole/240b26f9-dd88-4172-823d-4a8bfeb7841f") 231 | .method("POST", body) 232 | .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=") 233 | .addHeader("Content-Type", "application/json") 234 | .addHeader("Cookie", "JSESSIONID=299EEB7913BE50BACA8D795EBE6D0094") 235 | .build(); 236 | Response response = client.newCall(request).execute(); 237 | 238 | ``` 239 | 240 | ```javascript 241 | 242 | var requestHeaders = new Headers(); 243 | requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM="); 244 | requestHeaders.append("Content-Type", "application/json"); 245 | requestHeaders.append("Cookie", "JSESSIONID=299EEB7913BE50BACA8D795EBE6D0094"); 246 | 247 | var raw = JSON.stringify({"description":"A surgeon who assisted the Lead Surgeon"}); 248 | 249 | var requestOptions = { 250 | method: 'POST', 251 | headers: requestHeaders, 252 | body: raw, 253 | redirect: 'follow' 254 | }; 255 | 256 | fetch("/openmrs/ws/rest/v1/encounterrole/240b26f9-dd88-4172-823d-4a8bfeb7841f", requestOptions) 257 | .then(response => response.text()) 258 | .then(result => console.log(result)) 259 | .catch(error => console.log('error', error)); 260 | 261 | ``` 262 | 263 | 264 | * Update a target encounter role with given UUID, this method only modifies properties in the request. Returns a `404 Not Found` status if encounter role not exists. If the user is not logged in to perform this action, a `401 Unauthorized` status returned. 265 | 266 | ### Attributes 267 | 268 | Parameter | Type | Description 269 | --- | --- | --- 270 | *name* | `String` | Name for the encounter role 271 | *description* | `String | Description for the encounter role 272 | 273 | 274 | 275 | ## Delete an encounter role 276 | 277 | > Delete an encounter role 278 | 279 | ```shell 280 | DELETE /encounterrole/:target_encounter_role_uuid?purge=true 281 | ``` 282 | 283 | ```java 284 | 285 | OkHttpClient client = new OkHttpClient().newBuilder() 286 | .build(); 287 | MediaType mediaType = MediaType.parse("text/plain"); 288 | RequestBody body = RequestBody.create(mediaType, ""); 289 | Request request = new Request.Builder() 290 | .url("/openmrs/ws/rest/v1/encounterrole/240b26f9-dd88-4172-823d-4a8bfeb7841f?purge=true") 291 | .method("DELETE", body) 292 | .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=") 293 | .addHeader("Cookie", "JSESSIONID=299EEB7913BE50BACA8D795EBE6D0094") 294 | .build(); 295 | Response response = client.newCall(request).execute(); 296 | 297 | ``` 298 | 299 | ```javascript 300 | 301 | var requestHeaders = new Headers(); 302 | requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM="); 303 | requestHeaders.append("Cookie", "JSESSIONID=299EEB7913BE50BACA8D795EBE6D0094"); 304 | 305 | var requestOptions = { 306 | method: 'DELETE', 307 | headers: requestHeaders, 308 | redirect: 'follow' 309 | }; 310 | 311 | fetch("/openmrs/ws/rest/v1/encounterrole/240b26f9-dd88-4172-823d-4a8bfeb7841f?purge=true", requestOptions) 312 | .then(response => response.text()) 313 | .then(result => console.log(result)) 314 | .catch(error => console.log('error', error)); 315 | 316 | ``` 317 | 318 | * Delete or Void a target encounter role by its UUID. Returns a `404 Not Found` status if encounter role not exists. If the user is not logged in to perform this action, a `401 Unauthorized` status returned. 319 | 320 | ### Query Parameters 321 | 322 | Parameter | Type | Description 323 | --- | --- | --- 324 | *purge* | `Boolean` | The resource will be voided unless purge = ‘true’ 325 | 326 | -------------------------------------------------------------------------------- /source/includes/Forms/Forms.md: -------------------------------------------------------------------------------- 1 | # Forms 2 | 3 | ## Forms Overview 4 | 5 | * Forms in OpenMRS can be thought of as data collecting tools, which help in collecting patient data during an encounter with the patient (sometimes even after the encounter is over). 6 | * The concept dictionary is a central part of OpenMRS. Concepts can commonly be thought of as questions and possible answers which are present on forms. 7 | * Forms in OpenMRS can be of many types, e.g.,In almost all the instances observation forms which help in capturing observations during an encounter (like admission,Vitals e.t.c) 8 | 9 | 10 | ## Subresource types of Forms 11 | 12 | ### formFields 13 | 14 | * The FormField relates to the fields present on a form. A form can have many 0 or more fields associated with it in a hierarchical manner. 15 | * formFields can be used for persisting concepts like the date of collection, patient demographics, medications, allergies, and clinical observations 16 | 17 | 18 | ## Available operations for Forms 19 | 20 | 1. [List Forms](#search-forms) 21 | 3. [Create a form](#create-a-form) 22 | 4. [Update a form](#update-a-form) 23 | 5. [Delete a form](#delete-a-form) 24 | 6. [List formfields](#list-formfields) 25 | 7. [Create formFields subresource with properties](#create-formfield-subresource-with-properties) 26 | 8. [Update formFields subresource with properties](#update-formfields-subresource-with-properties) 27 | 9. [Delete formFields subresource with properties](#delete-formfields-subresource-with-properties) 28 | 29 | 30 | ## List Forms 31 | 32 | ### search-forms 33 | 34 | ```console 35 | GET /form? 36 | ``` 37 | 38 | Fetch all non-retired Forms that match any specified parameters otherwise fetch all non-retired forms. Returns a `200 OK` status with the form response, 39 | and returns a `401` response when the user is not logged in. 40 | 41 | ### Query Parameters 42 | 43 | Parameter | Description 44 | --- | --- 45 | *limit* | use this parameter to limit the number of results to be returned 46 | *startIndex* | the offset where to start the query 47 | *v* | the required representation to return (i.e., ref, default, full or custom ) 48 | *q* | the search query 49 | 50 | 51 | 52 | ### List forms by UUID 53 | 54 | ```console 55 | GET /form/:target_form_uuid 56 | ``` 57 | 58 | Retrieve a form by its UUID. Returns a `404 Not Found` status if the form does not exist in the system. If the user is not logged in to perform this action, a `401 Unauthorized` status is returned. 59 | 60 | ### Query Parameters 61 | 62 | Parameter | Description 63 | --- | --- 64 | *v* | the required representation to return (i.e. ref, default, full or custom ) 65 | *uuid* | the target form UUID 66 | 67 | 68 | ## Create-a-form 69 | 70 | ```console 71 | POST /form 72 | { 73 | "name": "Admission", 74 | "description": "dummy description", 75 | "version": "1.0", 76 | "encounterType": "Vitals", 77 | "published": true, 78 | "formFields": [ 79 | "medication","allergies" 80 | ], 81 | "xslt": "xslt specification for this form", 82 | "template": "dummy template" 83 | } 84 | ``` 85 | 86 | * To create a Form, you need to specify the below properties in the request. If you are not logged in to perform this action, a `401 Unauthorized` status is returned. 87 | 88 | ### Properties 89 | 90 | Parameter | Type | Description 91 | --- | --- | --- 92 | *name* | `String` | name of the form resource to be created 93 | *description* | `String` | description of the form resource to be created 94 | *version* | `String` | current version of the form resource to be created 95 | *encouterType* | `String` | the specific encounter type where this form is designed to collect data 96 | *published* | `boolean` | whether the form has been published or not 97 | *formFields* | `Array[]: formFields` | list of formFields associated with this form 98 | *xslt* | `String` | specifying XSLT description for the form if it supports XSLT transformations 99 | *template* | `String` | template of the form to be created 100 | 101 | 102 | ## Update a form 103 | 104 | ```console 105 | POST /form/:target_form_uuid 106 | { 107 | "name": "Admission", 108 | "description": "dummy description", 109 | "version": "1.0", 110 | "encounterType": "Vitals", 111 | "published": true, 112 | "formFields": [ 113 | "medication","allergies" 114 | ], 115 | "xslt": "xslt specification for this form", 116 | "template": "dummy template" 117 | } 118 | ``` 119 | 120 | 121 | * Update a target Form with given UUID, this method only modifies properties in the request. 122 | Returns a `404 Not Found` status if form not exists. If the user is not logged in to perform this action, a `401 Unauthorized status returned`. 123 | 124 | ### Query Parameters 125 | 126 | Parameter | Type | Description 127 | --- | --- | --- 128 | *uuid* | `target_form_uuid` | Target form resource UUID 129 | 130 | ### Properties 131 | 132 | Parameter | Type | Description 133 | --- | --- | --- 134 | *name* | `String` | name of the form resource to be created 135 | *description* | `String` | description of the form resource to be created 136 | *version* | `String` | current version of the form resource to be created 137 | *encouterType* | `String` | the specific encounter type where this form is designed to collect data 138 | *published* | `boolean` | whether the form has been published or not 139 | *formFields* | `Array[]: formFields` | list of formFields associated with this form 140 | *xslt* | `String` | specifying XSLT description for the form if it supports XSLT transformations 141 | *template* | `String` | template of the form to be created 142 | 143 | 144 | ## Delete a form 145 | 146 | ```console 147 | DELETE /form/:target_form_uuid?purge=true 148 | ``` 149 | 150 | * Delete or retire a target form by its UUID. Returns a `404 Not Found` status if the form does not exist. If the user is not logged in to perform this action, a `401 Unauthorized` status returned. 151 | 152 | ### Query Parameters 153 | 154 | Parameter | Type | Description 155 | --- | --- | --- 156 | **uuid** | `String` | uuid to delete 157 | *purge* | `Boolean` | The form will be voided/retired unless purge = 'true' 158 | 159 | 160 | ## List formfields 161 | 162 | ### List all formFields subresources for a form. 163 | 164 | ```console 165 | GET /form/:target_form_uuid/formfield 166 | ``` 167 | 168 | Retrieve all formFields subresources of a form resource by `target_form_uuid`. Returns a `404 Not Found` status if formFields not exist. If the user is not logged in to perform this action, a `401 unauthorized` status returned. 169 | 170 | ### List formFields subresource by its UUID and parent form UUID. 171 | 172 | ```console 173 | GET /form/:target_form_uuid/formfield/:target_formFields_uuid 174 | ``` 175 | 176 | Retrieve a formFields subresources of a form resource. Returns a `404 Not Found` status if formFields does not exist. If you are not logged in to perform this action, a `401 Unauthorized` status returned. 177 | 178 | ## create formfield subresource with properties 179 | 180 | ```console 181 | POST form/:target_form_uuid/formfield 182 | { 183 | form: "UUID", 184 | field: "UUID", 185 | required: false, 186 | parent: "UUID", 187 | fieldNumber: 2, 188 | fieldPart: "4", 189 | pageNumber: 1, 190 | minOccurs: 0, 191 | maxOccurs: 1, 192 | sortWeight: false 193 | } 194 | ``` 195 | 196 | * To create a formFields subresource for a specific form resource, you need to specify below properties in your request body. 197 | If the user is not logged in to perform this action, a `401 Unauthorized` status returned. 198 | 199 | ### Query parameter 200 | Parameter | Description 201 | --- | --- 202 | `target_form_uuid` | form resource uuid 203 | 204 | ### Properties for resource 205 | 206 | Parameter | Type | Description 207 | --- | --- | --- 208 | *form* | `String` | UUID of the parent form resource 209 | *field* | `String` | UUID of the formField to be created for the parent form 210 | *required* | `String` | if this field is required for the form to be submitted or not 211 | *parent* | `String` | parent form of this formField 212 | *fieldNumber* | `integer` | the number specified to this field in form 213 | *fieldPart* | `String` | the part specified to this field (like 1.4) here 4 is the field part and 1 is the field number. 214 | *PageNumber* | `String` | the page number where this field appears on the form 215 | *minOccurs* | `integer` | the minimum number of times this field appears on the form 216 | *maxOccurs* | `integer` | the maximum number of times this field appears on the form 217 | *sortWeight* | `boolean` | do we order this field or not, when this field will be searched for 218 | 219 | ## Update formFields subresource with properties 220 | 221 | ```console 222 | POST form/:target_form_uuid/formfield/:target_formFields_uuid 223 | { 224 | form: "UUID", 225 | field: "UUID", 226 | required: false, 227 | parent: "UUID", 228 | fieldNumber: 2, 229 | fieldPart: "4", 230 | pageNumber: 1, 231 | minOccurs: 0, 232 | maxOccurs: 1, 233 | sortWeight: false 234 | } 235 | ``` 236 | 237 | * Updates a formFields subresource value with given UUID. This method will only modify the value of the subresource. Returns a `404 Not Found` status if attribute not exists. If user not logged in to perform this action, a `401 Unauthorized` status 238 | returned. 239 | 240 | ### Query parameter 241 | Parameter | Description 242 | --- | --- 243 | `target_form_uuid` | form resource uuid 244 | `target_formFields_uuid` | formFields subresource uuid 245 | 246 | 247 | ### Properties 248 | 249 | Parameter | Type | Description 250 | --- | --- | --- 251 | *form* | `String` | UUID of the parent form resource 252 | *field* | `String` | UUID of the formField to be created for the parent form 253 | *required* | `String` | if this field is required for the form to be submitted or not 254 | *parent* | `String` | parent form of this formField 255 | *fieldNumber* | `integer` | the number specified to this field in form 256 | *fieldPart* | `String` | the part specified to this field (like 1.4) here 4 is the field part and 1 is the field number. 257 | *PageNumber* | `String` | the page number where this field appears on the form 258 | *minOccurs* | `integer` | the minimum number of times this field appears on the form 259 | *maxOccurs* | `integer` | the maximum number of times this field appears on the form 260 | *sortWeight* | `boolean` | do we order this field or not, when this field will be searched for 261 | 262 | 263 | 264 | ## Delete formFields subresource with properties 265 | 266 | ```console 267 | DELETE /form/:target_form_uuid/formfield/:target_formFields_uuid 268 | ``` 269 | 270 | * Delete or retire a target formFields subresource by its UUID. Returns a `404 Not Found` status if attribute not exists. 271 | If the user is not logged in to perform this action, a `401 Unauthorized` status returned. 272 | 273 | ### Query Parameters 274 | 275 | Parameter | Type | Description 276 | --- | --- | --- 277 | **uuid** | `String` | uuid of parent form to delete 278 | **uuid** | `String` | uuid of formFields to delete 279 | *purge* | `Boolean` | The resource will be voided/retired unless purge = ‘true’ 280 | 281 | 282 | -------------------------------------------------------------------------------- /source/includes/ImplementationId/implementation_id.md: -------------------------------------------------------------------------------- 1 | # Implementation Id Configuration 2 | 3 | ## Available operations for Implementation Id Configuration 4 | 5 | 1. [Retrieve Configuration](#retrieve-configuration) 6 | 2. [Update Configuration](#update-configuration) 7 | 8 | ## Retrieve Configuration 9 | 10 | > Retrieve Configuration 11 | 12 | ```shell 13 | GET /implementationid 14 | ``` 15 | 16 | ```java 17 | OkHttpClient client = new OkHttpClient().newBuilder() 18 | .build(); 19 | Request request = new Request.Builder() 20 | .url("/openmrs/ws/rest/v1/implementationid") 21 | .method("GET", null) 22 | .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=") 23 | .addHeader("Cookie", "JSESSIONID=1B06650EB0428F51EC119C909F58327C") 24 | .build(); 25 | Response response = client.newCall(request).execute(); 26 | ``` 27 | 28 | ```javascript 29 | var requestHeaders = new Headers(); 30 | requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM="); 31 | requestHeaders.append("Cookie", "JSESSIONID=1B06650EB0428F51EC119C909F58327C"); 32 | 33 | var requestOptions = { 34 | method: 'GET', 35 | headers: requestHeaders, 36 | redirect: 'follow' 37 | }; 38 | 39 | fetch("/openmrs/ws/rest/v1/implementationid", requestOptions) 40 | .then(response => response.text()) 41 | .then(result => console.log(result)) 42 | .catch(error => console.log('error', error)); 43 | ``` 44 | 45 | > Success Response 46 | 47 | ```response 48 | { 49 | "name": "name", 50 | "description": "recovering teest", 51 | "implementationId": "implementationId", 52 | "passphrase": "passphrase" 53 | } 54 | ``` 55 | 56 | Retrieves current configuration. 57 | 58 | ## Update Configuration 59 | 60 | > Update Configuration 61 | 62 | ```shell 63 | POST /implementationid 64 | { 65 | "name": "name", 66 | "description": "description", 67 | "implementationId": "implementationId", 68 | "passphrase": "passphrase" 69 | } 70 | ``` 71 | 72 | ```java 73 | OkHttpClient client = new OkHttpClient().newBuilder() 74 | .build(); 75 | MediaType mediaType = MediaType.parse("application/json"); 76 | RequestBody body = RequestBody.create(mediaType, "{\"name\": \"name\",\"description\": \"description\",\"implementationId\": \"implementationId\",\"passphrase\": \"passphrase\"}"); 77 | Request request = new Request.Builder() 78 | .url("/openmrs/ws/rest/v1/implementationid") 79 | .method("POST", body) 80 | .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=") 81 | .addHeader("Content-Type", "application/json") 82 | .addHeader("Cookie", "JSESSIONID=1B06650EB0428F51EC119C909F58327C") 83 | .build(); 84 | Response response = client.newCall(request).execute(); 85 | ``` 86 | 87 | ```javascript 88 | var requestHeaders = new Headers(); 89 | requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM="); 90 | requestHeaders.append("Content-Type", "application/json"); 91 | requestHeaders.append("Cookie", "JSESSIONID=1B06650EB0428F51EC119C909F58327C"); 92 | 93 | var raw = JSON.stringify({"name": "name","description": "description","implementationId": "implementationId","passphrase": "passphrase"}); 94 | 95 | var requestOptions = { 96 | method: 'POST', 97 | headers: requestHeaders, 98 | body: raw, 99 | redirect: 'follow' 100 | }; 101 | 102 | fetch("/openmrs/ws/rest/v1/implementationid", requestOptions) 103 | .then(response => response.text()) 104 | .then(result => console.log(result)) 105 | .catch(error => console.log('error', error)); 106 | ``` 107 | 108 | Updates current configuration with the following properties: 109 | 110 | ### Attributes 111 | Parameter | Type | Description 112 | --- | --- | --- 113 | *name* | `String` | A descriptive name for this implementation (e.g. AMRS installation in Eldoret, Kenya) 114 | *description* | `String` | Text describing this implementation. (e.g. Source for the AMPATH program in Kenya. Created by Paul Biondich) 115 | *implementationId* | `String` | This is the unique id for this implementation. Used as the HL7_CODE. Must be limited to 20 characters and numbers. The characters "^" and "|" are not allowed. 116 | *passphrase* | `String` | This text is a long text string that is used to validate who uses your implementation id. Multiple installations of openmrs can use the same implmentation id, but they must all know the passphrase. (Note that if an implementation id is shared, it is assumed that those installations are the same implementation). 117 | -------------------------------------------------------------------------------- /source/includes/LocaleAndTheme/locale_and_theme_configuration.md: -------------------------------------------------------------------------------- 1 | # Locale and Theme Configuration 2 | 3 | ## Locale and Theme Configuration Overview 4 | 5 | You can set default theme and default locale via REST API. 6 | 7 | ## Available operations for Locale and Theme Configuration 8 | 9 | 1. [Retrieve Configuration](#retrieve-configuration) 10 | 2. [Update Configuration](#update-configuration) 11 | 12 | ## Retrieve Configuration 13 | 14 | > Retrieve Configuration 15 | 16 | ```shell 17 | GET /localeandthemeconfiguration 18 | ``` 19 | 20 | ```java 21 | OkHttpClient client = new OkHttpClient().newBuilder() 22 | .build(); 23 | Request request = new Request.Builder() 24 | .url("/openmrs/ws/rest/v1/localeandthemeconfiguration") 25 | .method("GET", null) 26 | .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=") 27 | .addHeader("Cookie", "JSESSIONID=1B06650EB0428F51EC119C909F58327C") 28 | .build(); 29 | Response response = client.newCall(request).execute(); 30 | ``` 31 | 32 | 33 | ```javascript 34 | var requestHeaders = new Headers(); 35 | requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM="); 36 | requestHeaders.append("Cookie", "JSESSIONID=1B06650EB0428F51EC119C909F58327C"); 37 | 38 | var requestOptions = { 39 | method: 'GET', 40 | headers: requestHeaders, 41 | redirect: 'follow' 42 | }; 43 | 44 | fetch("/openmrs/ws/rest/v1/localeandthemeconfiguration", requestOptions) 45 | .then(response => response.text()) 46 | .then(result => console.log(result)) 47 | .catch(error => console.log('error', error)); 48 | ``` 49 | 50 | > Success Response 51 | 52 | ```response 53 | { 54 | "defaultLocale": "en_GB", 55 | "defaultTheme": "green" 56 | } 57 | ``` 58 | 59 | Retrieves current configuration. 60 | 61 | ## Update Configuration 62 | 63 | > Update Configuration 64 | 65 | ```shell 66 | POST /localeandthemeconfiguration 67 | { 68 | "defaultLocale": "en_GB", 69 | "defaultTheme": "green" 70 | } 71 | ``` 72 | 73 | ```java 74 | OkHttpClient client = new OkHttpClient().newBuilder() 75 | .build(); 76 | MediaType mediaType = MediaType.parse("application/json"); 77 | RequestBody body = RequestBody.create(mediaType, "{\"defaultLocale\": \"en_GB\",\"defaultTheme\": \"green\"}"); 78 | Request request = new Request.Builder() 79 | .url("/openmrs/ws/rest/v1/localeandthemeconfiguration") 80 | .method("POST", body) 81 | .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=") 82 | .addHeader("Content-Type", "application/json") 83 | .addHeader("Cookie", "JSESSIONID=1B06650EB0428F51EC119C909F58327C") 84 | .build(); 85 | Response response = client.newCall(request).execute(); 86 | ``` 87 | 88 | ```javascript 89 | var requestHeaders = new Headers(); 90 | requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM="); 91 | requestHeaders.append("Content-Type", "application/json"); 92 | requestHeaders.append("Cookie", "JSESSIONID=1B06650EB0428F51EC119C909F58327C"); 93 | 94 | var raw = JSON.stringify({"defaultLocale": "en_GB","defaultTheme": "green"}); 95 | 96 | var requestOptions = { 97 | method: 'POST', 98 | headers: requestHeaders, 99 | body: raw, 100 | redirect: 'follow' 101 | }; 102 | 103 | fetch("/openmrs/ws/rest/v1/localeandthemeconfiguration", requestOptions) 104 | .then(response => response.text()) 105 | .then(result => console.log(result)) 106 | .catch(error => console.log('error', error)); 107 | ``` 108 | 109 | Updates current configuration with the following properties: 110 | 111 | ### Attributes 112 | Parameter | Type | Description 113 | --- | --- | --- 114 | *defaultLocale* | `String` | Default Locale for OpenMRS instance. Has to be a valid language code. For example: en, en_GB, es 115 | *defaultTheme* | `String` | Default Theme for OpenMRS instance. For example: "orange", "purple", "green", and "legacy" 116 | -------------------------------------------------------------------------------- /source/includes/Patient/patient_identifier_log_entry.md: -------------------------------------------------------------------------------- 1 | # Patient Identifier LogEntry 2 | 3 | ## LogEntry Overview 4 | 5 | LogEntry is a resource that encapsulates Log entry for Patient Identifier generation event. 6 | 7 | ## Available operations for LogEntry 8 | 9 | 1. [List LogEntries](#list-logentries) 10 | 11 | ## List LogEntries 12 | 13 | > List LogEntries 14 | 15 | ```shell 16 | GET idgen/logentry?v=default 17 | ``` 18 | 19 | ```java 20 | OkHttpClient client = new OkHttpClient().newBuilder() 21 | .build(); 22 | Request request = new Request.Builder() 23 | .url("/openmrs/ws/rest/v1/idgen/logentry?v=default) 24 | .method("GET", null) 25 | .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=") 26 | .addHeader("Cookie", "JSESSIONID=A2AF09658C73E1ECEC5D3C8C7C249A2D") 27 | .build(); 28 | Response response = client.newCall(request).execute(); 29 | ``` 30 | 31 | ```javascript 32 | var requestHeaders = new Headers(); 33 | requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM="); 34 | requestHeaders.append("Cookie", "JSESSIONID=A2AF09658C73E1ECEC5D3C8C7C249A2D"); 35 | 36 | var requestOptions = { 37 | method: 'GET', 38 | headers: requestHeaders, 39 | redirect: 'follow' 40 | }; 41 | 42 | fetch("/openmrs/ws/rest/v1/idgen/logentry?v=default", requestOptions) 43 | .then(response => response.text()) 44 | .then(result => console.log(result)) 45 | .catch(error => console.log('error', error)); 46 | ``` 47 | 48 | > Success Response 49 | 50 | ```response 51 | { 52 | "results": [ 53 | { 54 | "uuid": "10503A", 55 | "links": [ 56 | { 57 | "rel": "self", 58 | "uri": "http://localhost:8080/openmrs/ws/rest/v1/idgen/logentry/10503A", 59 | "resourceAlias": "logentry" 60 | }, 61 | { 62 | "rel": "full", 63 | "uri": "http://localhost:8080/openmrs/ws/rest/v1/idgen/logentry/10503A?v=full", 64 | "resourceAlias": "logentry" 65 | } 66 | ], 67 | "resourceVersion": "1.8", 68 | "source": { 69 | "uuid": "47ea53ab-e57a-4671-b2c8-63a4b31bb140", 70 | "name": "pool", 71 | "identifierType": { 72 | "uuid": "05a29f94-c0ed-11e2-94be-8c13b969e334", 73 | "display": "OpenMRS ID", 74 | "name": "OpenMRS ID", 75 | "description": "OpenMRS patient identifier, with check-digit", 76 | "format": null, 77 | "formatDescription": null, 78 | "required": true, 79 | "validator": "org.openmrs.module.idgen.validator.LuhnMod30IdentifierValidator", 80 | "locationBehavior": null, 81 | "uniquenessBehavior": null, 82 | "retired": false, 83 | "links": [ 84 | { 85 | "rel": "self", 86 | "uri": "http://localhost:8080/openmrs/ws/rest/v1/patientidentifiertype/05a29f94-c0ed-11e2-94be-8c13b969e334", 87 | "resourceAlias": "patientidentifiertype" 88 | }, 89 | { 90 | "rel": "full", 91 | "uri": "http://localhost:8080/openmrs/ws/rest/v1/patientidentifiertype/05a29f94-c0ed-11e2-94be-8c13b969e334?v=full", 92 | "resourceAlias": "patientidentifiertype" 93 | } 94 | ], 95 | "resourceVersion": "2.0" 96 | }, 97 | "display": "OpenMRS ID - pool - org.openmrs.module.idgen.IdentifierPool", 98 | "links": [ 99 | { 100 | "rel": "self", 101 | "uri": "http://localhost:8080/openmrs/ws/rest/v1/idgen/identifiersource/47ea53ab-e57a-4671-b2c8-63a4b31bb140", 102 | "resourceAlias": "identifiersource" 103 | } 104 | ], 105 | "type": "identifierpool", 106 | "resourceVersion": "1.8" 107 | }, 108 | "identifier": "10503A", 109 | "comment": "Batch Export of 5 to file", 110 | "generatedBy": { 111 | "uuid": "1c3db49d-440a-11e6-a65c-00e04c680037", 112 | "display": "admin", 113 | "username": "admin", 114 | "systemId": "admin", 115 | "userProperties": { 116 | "loginAttempts": "0", 117 | "lockoutTimestamp": "", 118 | "emrapi.lastViewedPatientIds": "7,8" 119 | }, 120 | "person": { 121 | "uuid": "1296b0dc-440a-11e6-a65c-00e04c680037", 122 | "display": "Super User", 123 | "links": [ 124 | { 125 | "rel": "self", 126 | "uri": "http://localhost:8080/openmrs/ws/rest/v1/person/1296b0dc-440a-11e6-a65c-00e04c680037", 127 | "resourceAlias": "person" 128 | } 129 | ] 130 | }, 131 | "privileges": [], 132 | "roles": [ 133 | { 134 | "uuid": "8d94f852-c2cc-11de-8d13-0010c6dffd0f", 135 | "display": "System Developer", 136 | "links": [ 137 | { 138 | "rel": "self", 139 | "uri": "http://localhost:8080/openmrs/ws/rest/v1/role/8d94f852-c2cc-11de-8d13-0010c6dffd0f", 140 | "resourceAlias": "role" 141 | } 142 | ] 143 | }, 144 | { 145 | "uuid": "8d94f280-c2cc-11de-8d13-0010c6dffd0f", 146 | "display": "Provider", 147 | "links": [ 148 | { 149 | "rel": "self", 150 | "uri": "http://localhost:8080/openmrs/ws/rest/v1/role/8d94f280-c2cc-11de-8d13-0010c6dffd0f", 151 | "resourceAlias": "role" 152 | } 153 | ] 154 | } 155 | ], 156 | "retired": false, 157 | "links": [ 158 | { 159 | "rel": "self", 160 | "uri": "http://localhost:8080/openmrs/ws/rest/v1/user/1c3db49d-440a-11e6-a65c-00e04c680037", 161 | "resourceAlias": "user" 162 | }, 163 | { 164 | "rel": "full", 165 | "uri": "http://localhost:8080/openmrs/ws/rest/v1/user/1c3db49d-440a-11e6-a65c-00e04c680037?v=full", 166 | "resourceAlias": "user" 167 | } 168 | ], 169 | "resourceVersion": "1.8" 170 | }, 171 | "dateGenerated": "2021-06-25T21:37:33.000+0200" 172 | } 173 | ], 174 | "links": [ 175 | { 176 | "rel": "next", 177 | "uri": "http://localhost:8080/openmrs/ws/rest/v1/idgen/logentry?v=default&startIndex=50", 178 | "resourceAlias": null 179 | } 180 | ] 181 | } 182 | ``` 183 | 184 | You can also filter Log Entries with given query parameters. 185 | If not logged in to perform this action, a `401 Unauthorized` status is returned. 186 | 187 | ### Query Parameters 188 | 189 | | Parameter | Type | Description | 190 | | ------------ | ---------------| ------------------------------------- | 191 | | [_source_](#patientidentifiersource) | `PatientIdentifierSource_UUID` | Filter entries by source | 192 | | _fromDate_ | `Date` | Filter entries older than date | 193 | | _toDate_ | `Date` | Filter entries younger than date | 194 | | _identifier_ | `String` | Filter entries by generated identifier | 195 | | _comment_ | `String` | Filter entries by generation event's comment | 196 | | [_generatedBy_](#user) | `User_UUID` | Filter entries by user who executed generation | 197 | 198 | 199 | ## Get LogEntry by Identifier 200 | 201 | > Get LogEntry by Identifier 202 | 203 | ```shell 204 | GET idgen/logentry/:identifier 205 | ``` 206 | 207 | ```java 208 | OkHttpClient client = new OkHttpClient().newBuilder() 209 | .build(); 210 | Request request = new Request.Builder() 211 | .url("/openmrs/ws/rest/v1/idgen/logentry/:identifier) 212 | .method("GET", null) 213 | .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=") 214 | .addHeader("Cookie", "JSESSIONID=A2AF09658C73E1ECEC5D3C8C7C249A2D") 215 | .build(); 216 | Response response = client.newCall(request).execute(); 217 | ``` 218 | 219 | ```javascript 220 | var requestHeaders = new Headers(); 221 | requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM="); 222 | requestHeaders.append("Cookie", "JSESSIONID=A2AF09658C73E1ECEC5D3C8C7C249A2D"); 223 | 224 | var requestOptions = { 225 | method: 'GET', 226 | headers: requestHeaders, 227 | redirect: 'follow' 228 | }; 229 | 230 | fetch("/openmrs/ws/rest/v1/idgen/logentry/:identifier", requestOptions) 231 | .then(response => response.text()) 232 | .then(result => console.log(result)) 233 | .catch(error => console.log('error', error)); 234 | ``` 235 | 236 | You can also fetch log entry for a unique generated identifier. 237 | -------------------------------------------------------------------------------- /source/includes/Queue/queue.md: -------------------------------------------------------------------------------- 1 | # Queue 2 | 3 | ## Queue Overview 4 | 5 | * A queue in OpenMRS represents a line of patients waiting for a particular service in a specific location. For example, queues might be used for services such as triage, clinical consultation, lab or pharmacy. 6 | 7 | ## Available operations for Queues 8 | 9 | 1. [List queues](#list-queues) 10 | 2. [Create queue](#create-queue) 11 | 3. [Update queue](#update-queue) 12 | 4. [Void queue](#void-queue) 13 | 14 | ## List queues 15 | 16 | > List queues 17 | 18 | ```shell 19 | GET / 20 | ``` 21 | 22 | ```java 23 | 24 | OkHttpClient client = new OkHttpClient().newBuilder() 25 | .build(); 26 | Request request = new Request.Builder() 27 | .url("/openmrs/ws/rest/v1/queue) 28 | .method("GET", null) 29 | .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=") 30 | .addHeader("Cookie", "JSESSIONID=1B06650EB0428F51EC119C909F58327C") 31 | .build(); 32 | Response response = client.newCall(request).execute(); 33 | 34 | ``` 35 | 36 | ```javascript 37 | 38 | var requestHeaders = new Headers(); 39 | requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM="); 40 | requestHeaders.append("Cookie", "JSESSIONID=1B06650EB0428F51EC119C909F58327C"); 41 | 42 | var requestOptions = { 43 | method: 'GET', 44 | headers: requestHeaders, 45 | redirect: 'follow' 46 | }; 47 | 48 | fetch("/openmrs/ws/rest/v1/queue, requestOptions) 49 | .then(response => response.text()) 50 | .then(result => console.log(result)) 51 | .catch(error => console.log('error', error)); 52 | 53 | ``` 54 | 55 | > Success Response 56 | 57 | ```response 58 | { 59 | "results": [ 60 | { 61 | "uuid": "4890b934-73c3-4c91-a93b-ce48f728b520", 62 | "display": "Clinical consultation", 63 | "name": "Clinical consultation", 64 | "description": "Clinical consultation", 65 | "links": [ 66 | { 67 | "rel": "self", 68 | "uri": "http://qa-refapp.openmrs.org/openmrs/ws/rest/v1/queue/4890b934-73c3-4c91-a93b-ce48f728b520" 69 | }, 70 | { 71 | "rel": "full", 72 | "uri": "http://qa-refapp.openmrs.org/openmrs/ws/rest/v1/queue/4890b934-73c3-4c91-a93b-ce48f728b520?v=full" 73 | } 74 | ] 75 | }, 76 | { 77 | "uuid": "ae0e1ad7-08ba-4a3d-aeed-a757591faf83", 78 | "display": "Triage service", 79 | "name": "Triage service", 80 | "description": "Triage service", 81 | "links": [ 82 | { 83 | "rel": "self", 84 | "uri": "http://qa-refapp.openmrs.org/openmrs/ws/rest/v1/queue/ae0e1ad7-08ba-4a3d-aeed-a757591faf83" 85 | }, 86 | { 87 | "rel": "full", 88 | "uri": "http://qa-refapp.openmrs.org/openmrs/ws/rest/v1/queue/ae0e1ad7-08ba-4a3d-aeed-a757591faf83?v=full" 89 | } 90 | ] 91 | }, 92 | { 93 | "uuid": "501b135b-1733-445e-9616-a4a05cee1bdd", 94 | "display": "Lab service", 95 | "name": "Lab service", 96 | "description": "Lab service", 97 | "links": [ 98 | { 99 | "rel": "self", 100 | "uri": "http://qa-refapp.openmrs.org/openmrs/ws/rest/v1/queue/501b135b-1733-445e-9616-a4a05cee1bdd" 101 | }, 102 | { 103 | "rel": "full", 104 | "uri": "http://qa-refapp.openmrs.org/openmrs/ws/rest/v1/queue/501b135b-1733-445e-9616-a4a05cee1bdd?v=full" 105 | } 106 | ] 107 | } 108 | ] 109 | } 110 | ``` 111 | 112 | - If user not logged in to perform this action, a `401 Unauthorized` status returned. 113 | 114 | ## List queue by UUID 115 | 116 | > List queue by UUID 117 | 118 | ```shell 119 | GET /queue/:target_queue_uuid 120 | ``` 121 | 122 | ```java 123 | 124 | OkHttpClient client = new OkHttpClient().newBuilder() 125 | .build(); 126 | Request request = new Request.Builder() 127 | .url("/openmrs/ws/rest/v1/queue/36475629-6652-44e9-a42b-c2b3b7438f72") 128 | .method("GET", null) 129 | .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=") 130 | .addHeader("Cookie", "JSESSIONID=1B06650EB0428F51EC119C909F58327C") 131 | .build(); 132 | Response response = client.newCall(request).execute(); 133 | 134 | ``` 135 | 136 | ```javascript 137 | var requestHeaders = new Headers(); 138 | requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM="); 139 | requestHeaders.append("Cookie", "JSESSIONID=1B06650EB0428F51EC119C909F58327C"); 140 | 141 | var requestOptions = { 142 | method: "GET", 143 | headers: requestHeaders, 144 | redirect: "follow", 145 | }; 146 | 147 | fetch( 148 | "/openmrs/ws/rest/v1/queue/36475629-6652-44e9-a42b-c2b3b7438f72", 149 | requestOptions 150 | ) 151 | .then((response) => response.text()) 152 | .then((result) => console.log(result)) 153 | .catch((error) => console.log("error", error)); 154 | ``` 155 | 156 | - Retrieve a queue by its UUID. Returns a `404 Not Found` if queue to be retrieved not exist. If user not logged in to perform this action, a `401 Unauthorized` status returned. 157 | 158 | ## Create queue 159 | 160 | > Create queue 161 | 162 | ```shell 163 | POST /queue 164 | { 165 | "name": "Triage queue", 166 | "description": "This triage queue description", 167 | "service": { 168 | "uuid": "d3db3805-2b90-4330-9064-eb6d42cbf582" 169 | }, 170 | "location": { 171 | "uuid": "8d6c993e-c2cc-11de-8d13-0010c6dffd0f" 172 | } 173 | } 174 | ``` 175 | 176 | ```java 177 | 178 | OkHttpClient client = new OkHttpClient().newBuilder() 179 | .build(); 180 | MediaType mediaType = MediaType.parse("application/json"); 181 | RequestBody body = RequestBody.create(mediaType, "{\n \"name\": \"Triage queue\",\n \"description\": \"This triage queue description\",\n \"service\": {\n \"uuid\": \"d3db3805-2b90-4330-9064-eb6d42cbf582\"\n },\n \"location\": {\n \"uuid\": \"8d6c993e-c2cc-11de-8d13-0010c6dffd0f\"\n }\n}"); 182 | Request request = new Request.Builder() 183 | .url("/openmrs/ws/rest/v1/queue") 184 | .method("POST", body) 185 | .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=") 186 | .addHeader("Content-Type", "application/json") 187 | .addHeader("Cookie", "JSESSIONID=1B06650EB0428F51EC119C909F58327C") 188 | .build(); 189 | Response response = client.newCall(request).execute(); 190 | 191 | ``` 192 | 193 | ```javascript 194 | var requestHeaders = new Headers(); 195 | requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM="); 196 | requestHeaders.append("Content-Type", "application/json"); 197 | requestHeaders.append("Cookie", "JSESSIONID=1B06650EB0428F51EC119C909F58327C"); 198 | 199 | var raw = JSON.stringify({ 200 | name: "Triage queue", 201 | description: "This triage queue description", 202 | service: { 203 | uuid: "d3db3805-2b90-4330-9064-eb6d42cbf582", 204 | }, 205 | location: { 206 | uuid: "8d6c993e-c2cc-11de-8d13-0010c6dffd0f", 207 | }, 208 | }); 209 | 210 | var requestOptions = { 211 | method: "POST", 212 | headers: requestHeaders, 213 | body: raw, 214 | redirect: "follow", 215 | }; 216 | 217 | fetch("/openmrs/ws/rest/v1/queue", requestOptions) 218 | .then((response) => response.text()) 219 | .then((result) => console.log(result)) 220 | .catch((error) => console.log("error", error)); 221 | ``` 222 | 223 | - To create a queue you need to specify below attributes in the request body. If you are not logged in to perform this action, a `401 Unauthorized` status returned. 224 | 225 | ### Attributes 226 | 227 | Parameter | Type | Description 228 | --- | --- | --- 229 | *name* | `String` | Name of the queue 230 | *description* | `String` | Description of the queue 231 | *service* | `Concept_UUID` |Concept UUID describing this queue/service 232 | *[location](#location)* | `Location UUID` | Location resource UUID 233 | 234 | ## Update queue 235 | 236 | > Update queue 237 | 238 | ```shell 239 | POST /queue/:target_queue_uuid 240 | { 241 | "name": "TRIAGE QUEUE (updated)", 242 | "description": "Queue for patients waiting for triage(updated)" 243 | } 244 | ``` 245 | 246 | ```java 247 | 248 | OkHttpClient client = new OkHttpClient().newBuilder() 249 | .build(); 250 | MediaType mediaType = MediaType.parse("application/json"); 251 | RequestBody body = RequestBody.create(mediaType, "{\n \"name\": \"TRIAGE QUEUE (updated)\",\n \"description\": \"Queue for patients waiting for triage(updated)\"\n}"); 252 | Request request = new Request.Builder() 253 | .url("/openmrs/ws/rest/v1/queue/c298d3e1-6def-422a-9d0a-e18906a4ae73") 254 | .method("POST", body) 255 | .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=") 256 | .addHeader("Content-Type", "application/json") 257 | .addHeader("Cookie", "JSESSIONID=1B06650EB0428F51EC119C909F58327C") 258 | .build(); 259 | Response response = client.newCall(request).execute(); 260 | 261 | ``` 262 | 263 | ```javascript 264 | var requestHeaders = new Headers(); 265 | requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM="); 266 | requestHeaders.append("Content-Type", "application/json"); 267 | requestHeaders.append("Cookie", "JSESSIONID=1B06650EB0428F51EC119C909F58327C"); 268 | 269 | var raw = JSON.stringify({ 270 | name: "TRIAGE QUEUE (updated)", 271 | description: "Queue for patients waiting for triage(updated)", 272 | }); 273 | 274 | var requestOptions = { 275 | method: "POST", 276 | headers: requestHeaders, 277 | body: raw, 278 | redirect: "follow", 279 | }; 280 | 281 | fetch( 282 | "/openmrs/ws/rest/v1/queue/c298d3e1-6def-422a-9d0a-e18906a4ae73", 283 | requestOptions 284 | ) 285 | .then((response) => response.text()) 286 | .then((result) => console.log(result)) 287 | .catch((error) => console.log("error", error)); 288 | ``` 289 | 290 | - Updates the queue record. Only modifies the properties specified in the request. Returns a 404 Not found status if the queue(to be updated) doesn't exist. If not authenticated, 401 Unauthorized status is returned. 291 | 292 | ### Attributes 293 | 294 | | Parameter | Type | Description | 295 | | --------- | ------------ | --------------------------- | 296 | | UUID | `Queue UUID` | UUID of queue to be updated | 297 | 298 | ## Delete queue 299 | 300 | > Delete the target queue 301 | 302 | ```shell 303 | DELETE /queue/?purge=false 304 | ``` 305 | 306 | ```java 307 | 308 | OkHttpClient client = new OkHttpClient().newBuilder() 309 | .build(); 310 | MediaType mediaType = MediaType.parse("text/plain"); 311 | RequestBody body = RequestBody.create(mediaType, ""); 312 | Request request = new Request.Builder() 313 | .url("/openmrs/ws/rest/v1/queue/c298d3e1-6def-422a-9d0a-e18906a4ae73?purge=false") 314 | .method("DELETE", body) 315 | .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=") 316 | .addHeader("Cookie", "JSESSIONID=1B06650EB0428F51EC119C909F58327C") 317 | .build(); 318 | Response response = client.newCall(request).execute(); 319 | 320 | ``` 321 | 322 | ```javascript 323 | var requestHeaders = new Headers(); 324 | requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM="); 325 | requestHeaders.append("Cookie", "JSESSIONID=1B06650EB0428F51EC119C909F58327C"); 326 | 327 | var requestOptions = { 328 | method: "DELETE", 329 | headers: requestHeaders, 330 | redirect: "follow", 331 | }; 332 | 333 | fetch( 334 | "/openmrs/ws/rest/v1/queue/c298d3e1-6def-422a-9d0a-e18906a4ae73?purge=false", 335 | requestOptions 336 | ) 337 | .then((response) => response.text()) 338 | .then((result) => console.log(result)) 339 | .catch((error) => console.log("error", error)); 340 | ``` 341 | 342 | - Voids or delete the target queue. Returns a 404 Not found status if the queue(to be voided) doesn't exist. If not authenticated, 401 Unauthorized status is returned. 343 | 344 | ### Query Parameters 345 | 346 | Parameter | Type | Description 347 | --- | --- | --- 348 | *purge* | `Boolean` | The resource will be voided/retired unless purge = ‘true’ 349 | UUID | `Queue UUID` | Queue resource UUID 350 | -------------------------------------------------------------------------------- /source/includes/SearchIndex/search_index.md: -------------------------------------------------------------------------------- 1 | # Search Index 2 | 3 | ## Available operations for Search Index 4 | 5 | 1. [Update Search Index](#update-search-index) 6 | 7 | ## Update Search Index 8 | 9 | > Update Search Index 10 | 11 | ```shell 12 | POST /searchindexupdate 13 | { 14 | "resource": "patient", 15 | "subResource": "patientidentifier", 16 | "uuid": "fd07779c-b8f1-4b90-b41b-45cf9bc538f8", 17 | "async": false 18 | } 19 | ``` 20 | 21 | ```java 22 | OkHttpClient client = new OkHttpClient().newBuilder() 23 | .build(); 24 | MediaType mediaType = MediaType.parse("application/json"); 25 | RequestBody body = RequestBody.create(mediaType, "{\"resource\": \"patient\",\"subResource\": \"patientidentifier\",\"uuid\": \"fd07779c-b8f1-4b90-b41b-45cf9bc538f8\",\"async\": false}"); 26 | Request request = new Request.Builder() 27 | .url("/openmrs/ws/rest/v1/searchindexupdate") 28 | .method("POST", body) 29 | .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=") 30 | .addHeader("Content-Type", "application/json") 31 | .addHeader("Cookie", "JSESSIONID=1B06650EB0428F51EC119C909F58327C") 32 | .build(); 33 | Response response = client.newCall(request).execute(); 34 | ``` 35 | 36 | ```javascript 37 | var requestHeaders = new Headers(); 38 | requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM="); 39 | requestHeaders.append("Content-Type", "application/json"); 40 | requestHeaders.append("Cookie", "JSESSIONID=1B06650EB0428F51EC119C909F58327C"); 41 | 42 | var raw = JSON.stringify({"resource": "patient","subResource": "patientidentifier","uuid": "fd07779c-b8f1-4b90-b41b-45cf9bc538f8","async": false}); 43 | 44 | var requestOptions = { 45 | method: 'POST', 46 | headers: requestHeaders, 47 | body: raw, 48 | redirect: 'follow' 49 | }; 50 | 51 | fetch("/openmrs/ws/rest/v1/searchindexupdate", requestOptions) 52 | .then(response => response.text()) 53 | .then(result => console.log(result)) 54 | .catch(error => console.log('error', error)); 55 | ``` 56 | 57 | Executes rebuild of search index. 58 | 59 | You can execute one of three operations: 60 | 61 | - rebuild whole search index by only passing "async" attribute 62 | 63 | - rebuild search index for resource by passing "resource" and optionally "subResource" attributes. 64 | 65 | - rebuild search index for one object by passing "uuid" attribute. 66 | 67 | ### Attributes 68 | Parameter | Type | Description 69 | --- | --- | --- 70 | *resource* | `String` | Resource name of type that you want to regenerate index for 71 | *subResource* | `String` | Resource name of subtype that you want to regenerate index for 72 | *uuid* | `UUID` | UUID of object that you want to regenerate index for 73 | *async* | `Boolean` | Should rebuilding index be executed asynchronously 74 | -------------------------------------------------------------------------------- /source/includes/SystemInformation/loggedin_users.md: -------------------------------------------------------------------------------- 1 | # Logged in Users 2 | 3 | ## Logged in Users Overview 4 | 5 | OpenMRS REST API allows you to query list of logged in usernames. 6 | 7 | ## List Logged in Users 8 | 9 | > List Logged in Users 10 | 11 | ```shell 12 | GET /loggedinusers 13 | ``` 14 | 15 | ```java 16 | OkHttpClient client = new OkHttpClient().newBuilder() 17 | .build(); 18 | Request request = new Request.Builder() 19 | .url("/openmrs/ws/rest/v1/loggedinusers") 20 | .method("GET", null) 21 | .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=") 22 | .addHeader("Cookie", "JSESSIONID=ACC5AAAB3FE29B0A1A2C239EC00B8710") 23 | .build(); 24 | Response response = client.newCall(request).execute(); 25 | ``` 26 | 27 | ```javascript 28 | var requestHeaders = new Headers(); 29 | requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM="); 30 | requestHeaders.append("Cookie", "JSESSIONID=ACC5AAAB3FE29B0A1A2C239EC00B8710"); 31 | 32 | var requestOptions = { 33 | method: 'GET', 34 | headers: requestHeaders, 35 | redirect: 'follow' 36 | }; 37 | 38 | fetch("/openmrs/ws/rest/v1/loggedinusers", requestOptions) 39 | .then(response => response.text()) 40 | .then(result => console.log(result)) 41 | .catch(error => console.log('error', error)); 42 | ``` 43 | > Success Response 44 | 45 | ```response 46 | [ 47 | "admin" 48 | ] 49 | ``` 50 | 51 | * Fetch list of logged in usernames. 52 | * If not authenticated or authenticated user does not have sufficient privileges, a `401 Unauthorized` status is returned. 53 | -------------------------------------------------------------------------------- /source/includes/SystemInformation/system_information.md: -------------------------------------------------------------------------------- 1 | # System Information 2 | 3 | ## System Information Overview 4 | 5 | * System Information directly fetches the system information from AdministrationService and displays it by splitting it into name value pairs across 5 headers in legacy UI module. 6 | 7 | Header | Brief Description 8 | --|-- 9 | 1. OpenMRS Information | This section holds information like OpenMRS Version Snapshot and other system wide informations like System Date and Time. 10 | 2. Java Runtime Environment Information | This section has the relevant Java parameters along with the the operating system and its architecture information.For e.g. `Operating System` : `Linux` 11 | 3. Memory Information | This section holds the total , free and the maximum heap Size memory information of the system. 12 | 4. Database Information | This section has the relevant information about the database. For e.g. `Database Schema name` : `openmrs-db` 13 | 5. Module Information | This section has the record of all the snapshot versions for each of the current modules. For e.g. `Allergy UI Module` : `1.8.3-SNAPSHOT` 14 | 15 | 16 | ## List System Inforamation 17 | 18 | > List system information 19 | 20 | ```shell 21 | 22 | GET /systeminformation 23 | 24 | ``` 25 | 26 | ```java 27 | 28 | OkHttpClient client = new OkHttpClient().newBuilder() 29 | .build(); 30 | Request request = new Request.Builder() 31 | .url("/openmrs/ws/rest/v1/systeminformation") 32 | .method("GET", null) 33 | .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=") 34 | .addHeader("Cookie", "JSESSIONID=ACC5AAAB3FE29B0A1A2C239EC00B8710") 35 | .build(); 36 | Response response = client.newCall(request).execute(); 37 | 38 | ``` 39 | 40 | ```javascript 41 | 42 | var requestHeaders = new Headers(); 43 | requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM="); 44 | requestHeaders.append("Cookie", "JSESSIONID=ACC5AAAB3FE29B0A1A2C239EC00B8710"); 45 | 46 | var requestOptions = { 47 | method: 'GET', 48 | headers: requestHeaders, 49 | redirect: 'follow' 50 | }; 51 | 52 | fetch("/openmrs/ws/rest/v1/systeminformation", requestOptions) 53 | .then(response => response.text()) 54 | .then(result => console.log(result)) 55 | .catch(error => console.log('error', error)); 56 | 57 | ``` 58 | > Success Response 59 | 60 | ```response 61 | 62 | { 63 | "systemInfo": { 64 | "SystemInfo.title.openmrsInformation": { 65 | "SystemInfo.OpenMRSInstallation.systemDate": "2020-10-14", 66 | "SystemInfo.OpenMRSInstallation.systemTime": "20:05:43", 67 | "SystemInfo.OpenMRSInstallation.openmrsVersion": "2.3.0 Build b3ade0", 68 | "SystemInfo.hostname": "f945457f1f48" 69 | }, 70 | "SystemInfo.title.javaRuntimeEnvironmentInformation": { 71 | "SystemInfo.JavaRuntimeEnv.operatingSystem": "Linux", 72 | "SystemInfo.JavaRuntimeEnv.operatingSystemArch": "amd64", 73 | "SystemInfo.JavaRuntimeEnv.operatingSystemVersion": "4.4.0-190-generic", 74 | "SystemInfo.JavaRuntimeEnv.javaVersion": "1.8.0_212", 75 | "SystemInfo.JavaRuntimeEnv.javaVendor": "Oracle Corporation", 76 | "SystemInfo.JavaRuntimeEnv.jvmVersion": "25.212-b01", 77 | "SystemInfo.JavaRuntimeEnv.jvmVendor": "Oracle Corporation", 78 | "SystemInfo.JavaRuntimeEnv.javaRuntimeName": "OpenJDK Runtime Environment", 79 | "SystemInfo.JavaRuntimeEnv.javaRuntimeVersion": "1.8.0_212-8u212-b01-1~deb9u1-b01", 80 | "SystemInfo.JavaRuntimeEnv.userName": "root", 81 | "SystemInfo.JavaRuntimeEnv.systemLanguage": "en", 82 | "SystemInfo.JavaRuntimeEnv.systemTimezone": "Etc/UTC", 83 | "SystemInfo.JavaRuntimeEnv.fileSystemEncoding": "UTF-8", 84 | "SystemInfo.JavaRuntimeEnv.userDirectory": "/usr/local/tomcat", 85 | "SystemInfo.JavaRuntimeEnv.tempDirectory": "/usr/local/tomcat/temp" 86 | }, 87 | "SystemInfo.title.memoryInformation": { 88 | "SystemInfo.Memory.totalMemory": "607 MB", 89 | "SystemInfo.Memory.freeMemory": "350 MB", 90 | "SystemInfo.Memory.maximumHeapSize": "683 MB" 91 | }, 92 | "SystemInfo.title.dataBaseInformation": { 93 | "SystemInfo.Database.name": "\"openmrs-db\"", 94 | "SystemInfo.Database.connectionURL": "jdbc:mysql://openmrs-referenceapplication-mysql:3306/\"openmrs-db\"?autoReconnect=true&sessionVariables=default_storage_engine=InnoDB&useUnicode=true&characterEncoding=UTF-8", 95 | "SystemInfo.Database.userName": "\"openmrs-user\"", 96 | "SystemInfo.Database.driver": null, 97 | "SystemInfo.Database.dialect": null 98 | }, 99 | "SystemInfo.title.moduleInformation": { 100 | "SystemInfo.Module.repositoryPath": "/usr/local/tomcat/.OpenMRS/modules", 101 | "Atlas Module": "2.2 ", 102 | "Form Entry App Module": "1.4.2 ", 103 | "Reporting": "1.20.0 ", 104 | "Metadata Sharing": "1.6.0 ", 105 | "ID Generation": "4.5.0 ", 106 | "Allergy UI Module": "1.8.2 ", 107 | "EMR API Module": "1.28.0 ", 108 | "Registration App Module": "1.16.0 ", 109 | "HTML Form Entry UI Framework Integration Module": "1.10.0 ", 110 | "App Framework Module": "2.14.0 ", 111 | "Reporting REST": "1.11.0 ", 112 | "Reference Metadata Module": "2.10.2 ", 113 | "Metadata Mapping": "1.3.4 ", 114 | "Admin UI Module": "1.3.0 ", 115 | "OpenMRS UI Framework": "3.17.0 ", 116 | "Reference Application Module": "2.10.0 ", 117 | "Metadata Deploy": "1.11.0 ", 118 | "App UI Module": "1.12.0 ", 119 | "Reporting Compatibility": "2.0.6 ", 120 | "HTML Widgets": "1.10.0 ", 121 | "Serialization Xstream": "0.2.14 ", 122 | "Address Hierarchy": "2.11.0 ", 123 | "Registration Core Module": "1.9.0 ", 124 | "Attachments": "2.2.0 ", 125 | "Core Apps Module": "1.28.0 ", 126 | "Event Module": "2.7.0 ", 127 | "Provider Management Module": "2.10.0 ", 128 | "Calculation": "1.2 ", 129 | "Appointment Scheduling UI Module": "1.9.0 ", 130 | "Open Web Apps Module": "1.10.0 ", 131 | "HTML Form Entry": "3.10.0 ", 132 | "FHIR Module": "1.20.0 ", 133 | "UI Commons Module": "2.12.0 ", 134 | "Reporting UI Module": "1.6.0 ", 135 | "Appointment Scheduling Module": "1.12.0 ", 136 | "Rest Web Services OMOD": "2.28.0.df1459 ", 137 | "Legacy UI Module": "1.6.0 ", 138 | "Data Exchange Module": "1.3.4 ", 139 | "Reference Demo Data Module": "1.4.5 ", 140 | "UI Library Module": "2.0.6 " 141 | } 142 | } 143 | } 144 | 145 | ``` 146 | 147 | 148 | * Fetch all System Information that match any specified parameters otherwise fetch all the System Information if no query parameters specified. 149 | * If not authenticated or authenticated user does not have sufficient privileges, a `401 Unauthorized` status is returned. 150 | 151 | ### Query Parameters 152 | 153 | Parameter | Type | Description 154 | --- | --- | --- 155 | *limit* | `integer`| use this parameter to limit the number of results to be returned 156 | *startIndex*| `integer` | the offset where to start the query 157 | *v* | `String` | the required representation to return (i.e., ref, default, full or custom ) 158 | 159 | -------------------------------------------------------------------------------- /source/includes/User/privileges.md: -------------------------------------------------------------------------------- 1 | # Privilege 2 | 3 | ## Overview 4 | 5 | A **Privilege** is an authorization to perform a particular action in the system. The list of available privileges are defined by the core system and by add-on modules (for example, **Delete Patients** and **Manage Encounter Types**), but you need to configure which roles have which privileges while you are configuring your system. 6 | 7 | ## Available operations. 8 | 9 | 1. [List privilege](#list-privilege) 10 | 2. [Create a privilege](#create-a-privilege) 11 | 3. [Update a privilege](#update-a-privilege) 12 | 4. [Delete a privilege](#delete-a-privilege) 13 | 14 | 15 | ## List privilege 16 | 17 | > List privilege 18 | 19 | ```shell 20 | GET /privilege?v=full&limit=1 21 | ``` 22 | 23 | ```java 24 | 25 | OkHttpClient client = new OkHttpClient().newBuilder() 26 | .build(); 27 | Request request = new Request.Builder() 28 | .url("/openmrs/ws/rest/v1/privilege?v=full&limit=1") 29 | .method("GET", null) 30 | .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=") 31 | .addHeader("Cookie", "JSESSIONID=A2AF09658C73E1ECEC5D3C8C7C249A2D") 32 | .build(); 33 | Response response = client.newCall(request).execute(); 34 | 35 | ``` 36 | 37 | ```javascript 38 | 39 | var myHeaders = new Headers(); 40 | myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM="); 41 | myHeaders.append("Cookie", "JSESSIONID=A2AF09658C73E1ECEC5D3C8C7C249A2D"); 42 | 43 | var requestOptions = { 44 | method: 'GET', 45 | headers: myHeaders, 46 | redirect: 'follow' 47 | }; 48 | 49 | fetch("/openmrs/ws/rest/v1/privilege?v=full&limit=1", requestOptions) 50 | .then(response => response.text()) 51 | .then(result => console.log(result)) 52 | .catch(error => console.log('error', error)); 53 | 54 | ``` 55 | 56 | > Success Response 57 | 58 | ```response 59 | 60 | { 61 | "results": [ 62 | { 63 | "uuid": "24635eec-dd5a-11e6-9d9c-0242ac150002", 64 | "display": "Add Concept Proposals", 65 | "name": "Add Concept Proposals", 66 | "description": "Able to add concept proposals to the system", 67 | "retired": false, 68 | "auditInfo": { 69 | "creator": null, 70 | "dateCreated": null, 71 | "changedBy": null, 72 | "dateChanged": null 73 | }, 74 | "links": [ 75 | { 76 | "rel": "self", 77 | "uri":"http://demo.openmrs.org/openmrs/ws/rest/v1/privilege/24635eec-dd5a-11e6-9d9c-0242ac150002" 78 | } 79 | ], 80 | "resourceVersion": "1.8" 81 | } 82 | ] 83 | } 84 | 85 | ``` 86 | 87 | 88 | 89 | * Fetch all privileges that match any specified parameters otherwise fetch all privileges. Returns a `200 OK` status with the privilege response. If not authenticated or authenticated user does not have sufficient privileges, a `401 Unauthorized` status is returned. 90 | 91 | 92 | 93 | ## Get privilege by UUID 94 | 95 | > Get privilege by UUID 96 | 97 | ```shell 98 | GET /privilege/:target_privilege_uuid 99 | ``` 100 | 101 | ```java 102 | 103 | OkHttpClient client = new OkHttpClient().newBuilder() 104 | .build(); 105 | Request request = new Request.Builder() 106 | .url("/openmrs/ws/rest/v1/privilege/fd40ed09-b499-405a-8b98-8154a6465e1a") 107 | .method("GET", null) 108 | .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=") 109 | .addHeader("Cookie", "JSESSIONID=A2AF09658C73E1ECEC5D3C8C7C249A2D") 110 | .build(); 111 | Response response = client.newCall(request).execute(); 112 | 113 | ``` 114 | 115 | ```javascript 116 | 117 | var myHeaders = new Headers(); 118 | myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM="); 119 | myHeaders.append("Cookie", "JSESSIONID=A2AF09658C73E1ECEC5D3C8C7C249A2D"); 120 | 121 | var requestOptions = { 122 | method: 'GET', 123 | headers: myHeaders, 124 | redirect: 'follow' 125 | }; 126 | 127 | fetch("/openmrs/ws/rest/v1/privilege/fd40ed09-b499-405a-8b98-8154a6465e1a", requestOptions) 128 | .then(response => response.text()) 129 | .then(result => console.log(result)) 130 | .catch(error => console.log('error', error)); 131 | 132 | ``` 133 | 134 | * Retrieve a privilege by its UUID. Returns a `404 Not Found` status if the privilege not exists. If not authenticated or authenticated user does not have sufficient privileges, a `401 Unauthorized` status is returned. 135 | 136 | 137 | 138 | ## Create a privilege 139 | 140 | > Create a privilege 141 | 142 | ```shell 143 | POST /privilege 144 | { 145 | "name": "Delete Patients", 146 | "description": "A privilege or permission to delete patients" 147 | } 148 | ``` 149 | 150 | ```java 151 | 152 | OkHttpClient client = new OkHttpClient().newBuilder() 153 | .build(); 154 | MediaType mediaType = MediaType.parse("application/json"); 155 | RequestBody body = RequestBody.create(mediaType, "{\r\n \"name\": \"Delete Patients\",\r\n \"description\": \"A privilege or permission to delete patients\"\r\n}\r\n"); 156 | Request request = new Request.Builder() 157 | .url("/openmrs/ws/rest/v1/privilege") 158 | .method("POST", body) 159 | .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=") 160 | .addHeader("Content-Type", "application/json") 161 | .addHeader("Cookie", "JSESSIONID=1A5193DBE052C38DC303BAD947A05A83") 162 | .build(); 163 | Response response = client.newCall(request).execute(); 164 | 165 | ``` 166 | 167 | ```javascript 168 | 169 | var myHeaders = new Headers(); 170 | myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM="); 171 | myHeaders.append("Content-Type", "application/json"); 172 | myHeaders.append("Cookie", "JSESSIONID=1A5193DBE052C38DC303BAD947A05A83"); 173 | 174 | var raw = JSON.stringify({"name":"Delete Patients","description":"A privilege or permission to delete patients"}); 175 | 176 | var requestOptions = { 177 | method: 'POST', 178 | headers: myHeaders, 179 | body: raw, 180 | redirect: 'follow' 181 | }; 182 | 183 | fetch("/openmrs/ws/rest/v1/privilege", requestOptions) 184 | .then(response => response.text()) 185 | .then(result => console.log(result)) 186 | .catch(error => console.log('error', error)); 187 | 188 | ``` 189 | 190 | 191 | * To create a privilege, you need to specify below attributes in the request body. If not authenticated or authenticated user does not have sufficient privileges, a `401 Unauthorized` status is returned. 192 | * If the name has already been used for some other privilege in use then a `500 Internal Server Error` status is returned. 193 | 194 | #### Attributes 195 | 196 | Parameter | Type | Description 197 | --- | --- | --- 198 | *name* | `String` | Name of the privilege(Required) 199 | *description* | `String` | Description of the privilege 200 | 201 | 202 | 203 | ## Update a privilege 204 | 205 | > Update a privilege 206 | 207 | ```shell 208 | POST /privilege/:target_privilege_uuid 209 | { 210 | "description": "A user who can delete all the encounter types" 211 | } 212 | ``` 213 | 214 | ```java 215 | 216 | OkHttpClient client = new OkHttpClient().newBuilder() 217 | .build(); 218 | MediaType mediaType = MediaType.parse("application/json"); 219 | RequestBody body = RequestBody.create(mediaType, "{\r\n \"description\": \"A user who can delete all the encounter types\"\r\n}\r\n"); 220 | Request request = new Request.Builder() 221 | .url("/openmrs/ws/rest/v1/privilege/246364a0-dd5a-11e6-9d9c-0242ac150002") 222 | .method("POST", body) 223 | .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=") 224 | .addHeader("Content-Type", "application/json") 225 | .addHeader("Cookie", "JSESSIONID=1A5193DBE052C38DC303BAD947A05A83") 226 | .build(); 227 | Response response = client.newCall(request).execute(); 228 | 229 | ``` 230 | 231 | ```javascript 232 | 233 | var myHeaders = new Headers(); 234 | myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM="); 235 | myHeaders.append("Content-Type", "application/json"); 236 | myHeaders.append("Cookie", "JSESSIONID=1A5193DBE052C38DC303BAD947A05A83"); 237 | 238 | var raw = JSON.stringify({"description":"A user who can delete all the encounter types"}); 239 | 240 | var requestOptions = { 241 | method: 'POST', 242 | headers: myHeaders, 243 | body: raw, 244 | redirect: 'follow' 245 | }; 246 | 247 | fetch("/openmrs/ws/rest/v1/privilege/246364a0-dd5a-11e6-9d9c-0242ac150002", requestOptions) 248 | .then(response => response.text()) 249 | .then(result => console.log(result)) 250 | .catch(error => console.log('error', error)); 251 | 252 | ``` 253 | 254 | 255 | * Update a privilege with given UUID, this method only modifies properties in the request. Returns a `404 Not Found`status, if the privilege does not exists. 256 | * If not authenticated or authenticated user does not have sufficient privileges, a `401 Unauthorized` status is returned. 257 | * Attempting to update a privilege's name will fail with the error code `400 Bad Request`. 258 | 259 | #### Attributes 260 | 261 | Parameter | Type | Description 262 | --- | --- | --- 263 | *name* | `String` | Name of the privilege(Required) 264 | *description* | `String` | Description of the privilege 265 | 266 | 267 | ## Delete a privilege 268 | 269 | > Delete a privilege 270 | 271 | ```shell 272 | DELETE /privilege/:target_privilege_uuid?purge=true 273 | ``` 274 | 275 | ```java 276 | 277 | OkHttpClient client = new OkHttpClient().newBuilder() 278 | .build(); 279 | MediaType mediaType = MediaType.parse("text/plain"); 280 | RequestBody body = RequestBody.create(mediaType, ""); 281 | Request request = new Request.Builder() 282 | .url("/openmrs/ws/rest/v1/privilege/24636447-dd5a-11e6-9d9c-0242ac150002?purge=true") 283 | .method("DELETE", body) 284 | .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=") 285 | .addHeader("Cookie", "JSESSIONID=1A5193DBE052C38DC303BAD947A05A83") 286 | .build(); 287 | Response response = client.newCall(request).execute(); 288 | 289 | ``` 290 | 291 | ```javascript 292 | 293 | var myHeaders = new Headers(); 294 | myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM="); 295 | myHeaders.append("Cookie", "JSESSIONID=1A5193DBE052C38DC303BAD947A05A83"); 296 | 297 | var requestOptions = { 298 | method: 'DELETE', 299 | headers: myHeaders, 300 | redirect: 'follow' 301 | }; 302 | 303 | fetch("/openmrs/ws/rest/v1/privilege/24636447-dd5a-11e6-9d9c-0242ac150002?purge=true", requestOptions) 304 | .then(response => response.text()) 305 | .then(result => console.log(result)) 306 | .catch(error => console.log('error', error)); 307 | 308 | ``` 309 | 310 | * Delete a privilege by its UUID. Returns a `404 Not Found` status if the privilege not exists. If not authenticated or authenticated user does not have sufficient privileges, a `401 Unauthorized` 311 | status is returned. 312 | * A `500 Internal server error` status is returned if user is trying to delete any currently used privilege. 313 | 314 | #### Query Parameters 315 | 316 | Parameter | Type | Description 317 | --- | --- | --- 318 | *purge* | `Boolean` | `true` to delete the privilege from the system; if `false`, the request will have no effect 319 | -------------------------------------------------------------------------------- /source/includes/User/role.md: -------------------------------------------------------------------------------- 1 | # Role 2 | 3 | ## Role Overview 4 | 5 | A **Role** represents a group of privileges in the system. Roles may inherit privileges from other roles, and users may have one or more roles. 6 | 7 | ## Available operations for Role. 8 | 9 | 1. [List roles](#list-roles) 10 | 2. [Create a role](#create-a-role) 11 | 3. [Update a role](#update-a-role) 12 | 4. [Delete a role](#delete-a-role) 13 | 14 | 15 | ## List roles 16 | 17 | > List roles 18 | 19 | ```shell 20 | GET /role?v=default&limit=1 21 | ``` 22 | ```java 23 | 24 | OkHttpClient client = new OkHttpClient().newBuilder() 25 | .build(); 26 | Request request = new Request.Builder() 27 | .url("https://demo.openmrs.org/openmrs/ws/rest/v1/role?limit=1&v=default") 28 | .method("GET", null) 29 | .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=") 30 | .addHeader("Cookie", "JSESSIONID=1A5193DBE052C38DC303BAD947A05A83") 31 | .build(); 32 | Response response = client.newCall(request).execute(); 33 | 34 | ``` 35 | 36 | ```javascript 37 | 38 | var requestHeaders = new Headers(); 39 | requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM="); 40 | requestHeaders.append("Cookie", "JSESSIONID=1A5193DBE052C38DC303BAD947A05A83"); 41 | 42 | var requestOptions = { 43 | method: 'GET', 44 | headers: requestHeaders, 45 | redirect: 'follow' 46 | }; 47 | 48 | fetch("https://demo.openmrs.org/openmrs/ws/rest/v1/role?limit=1&v=default", requestOptions) 49 | .then(response => response.text()) 50 | .then(result => console.log(result)) 51 | .catch(error => console.log('error', error)); 52 | 53 | ``` 54 | 55 | > Success Response 56 | 57 | ```response 58 | 59 | { 60 | "results": [ 61 | { 62 | "uuid": "774b2af3-6437-4e5a-a310-547554c7c65c", 63 | "display": "Anonymous", 64 | "name": "Anonymous", 65 | "description": "Privileges for non-authenticated users.", 66 | "retired": false, 67 | "privileges": [], 68 | "inheritedRoles": [], 69 | "links": [ 70 | { 71 | "rel": "self", 72 | "uri": "http://demo.openmrs.org/openmrs/ws/rest/v1/role/774b2af3-6437-4e5a-a310-547554c7c65c" 73 | }, 74 | { 75 | "rel": "full", 76 | "uri": "http://demo.openmrs.org/openmrs/ws/rest/v1/role/774b2af3-6437-4e5a-a310-547554c7c65c?v=full" 77 | } 78 | ], 79 | "resourceVersion": "1.8" 80 | } 81 | ], 82 | "links": [ 83 | { 84 | "rel": "next", 85 | "uri": "http://demo.openmrs.org/openmrs/ws/rest/v1/role?limit=1&v=default&startIndex=1" 86 | } 87 | ] 88 | } 89 | 90 | ``` 91 | 92 | 93 | 94 | * Fetch all the roles that match any specified parameters otherwise fetch all roles. Returns a `200 OK` status with the role response. If the user is not logged in to perform this action, a `401 Unauthorized` status is returned. 95 | 96 | 97 | ## Get a role by UUID. 98 | 99 | > Get a role by UUID 100 | 101 | ```shell 102 | GET /role/:target_role_uuid 103 | ``` 104 | 105 | ```java 106 | 107 | OkHttpClient client = new OkHttpClient().newBuilder() 108 | .build(); 109 | Request request = new Request.Builder() 110 | .url("https://demo.openmrs.org/openmrs/ws/rest/v1/role/774b2af3-6437-4e5a-a310-547554c7c65c") 111 | .method("GET", null) 112 | .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=") 113 | .addHeader("Cookie", "JSESSIONID=1A5193DBE052C38DC303BAD947A05A83") 114 | .build(); 115 | Response response = client.newCall(request).execute(); 116 | 117 | ``` 118 | 119 | ```javascript 120 | 121 | var requestHeaders = new Headers(); 122 | requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM="); 123 | requestHeaders.append("Cookie", "JSESSIONID=1A5193DBE052C38DC303BAD947A05A83"); 124 | 125 | var requestOptions = { 126 | method: 'GET', 127 | headers: requestHeaders, 128 | redirect: 'follow' 129 | }; 130 | 131 | fetch("https://demo.openmrs.org/openmrs/ws/rest/v1/role/774b2af3-6437-4e5a-a310-547554c7c65c", requestOptions) 132 | .then(response => response.text()) 133 | .then(result => console.log(result)) 134 | .catch(error => console.log('error', error)); 135 | 136 | ``` 137 | 138 | *Retrieve a role by its UUID. Returns a `404 Not Found` status if the role does not exist. If the user is not logged in to perform this action, a `401 Unauthorized` status is returned. 139 | 140 | 141 | ## Create a role 142 | 143 | > Create a role 144 | 145 | ```shell 146 | POST /role 147 | { 148 | "name": "Clinician", 149 | "description": "A provider assisting the Lead Surgeon.", 150 | "privileges": [ 151 | { 152 | "name": "Delete Patients", 153 | "description": "Able to delete patients" 154 | } 155 | ], 156 | "inheritedRoles": [ 157 | "774b2af3-6437-4e5a-a310-547554c7c65c" 158 | ] 159 | } 160 | 161 | ``` 162 | 163 | ```java 164 | 165 | OkHttpClient client = new OkHttpClient().newBuilder() 166 | .build(); 167 | MediaType mediaType = MediaType.parse("application/json"); 168 | RequestBody body = RequestBody.create(mediaType, "{\r\n \"name\": \"Clinician\",\r\n \"description\": \"A provider assisting the Lead Surgeon.\",\r\n \"privileges\": [\r\n {\r\n \"name\": \"Delete Patients\",\r\n \"description\": \"Able to delete patients\"\r\n }\r\n ],\r\n \"inheritedRoles\": [\r\n \"774b2af3-6437-4e5a-a310-547554c7c65c\"\r\n ]\r\n}"); 169 | Request request = new Request.Builder() 170 | .url("https://demo.openmrs.org/openmrs/ws/rest/v1/role") 171 | .method("POST", body) 172 | .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=") 173 | .addHeader("Content-Type", "application/json") 174 | .addHeader("Cookie", "JSESSIONID=955E778A4F700C5AA9651DAF6FC9DDDA") 175 | .build(); 176 | Response response = client.newCall(request).execute(); 177 | 178 | ``` 179 | 180 | ```javascript 181 | 182 | var requestHeaders = new Headers(); 183 | requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM="); 184 | requestHeaders.append("Content-Type", "application/json"); 185 | requestHeaders.append("Cookie", "JSESSIONID=955E778A4F700C5AA9651DAF6FC9DDDA"); 186 | 187 | var raw = JSON.stringify({"name":"Clinician","description":"A provider assisting the Lead Surgeon.","privileges":[{"name":"Delete Patients","description":"Able to delete patients"}],"inheritedRoles":["774b2af3-6437-4e5a-a310-547554c7c65c"]}); 188 | 189 | var requestOptions = { 190 | method: 'POST', 191 | headers: requestHeaders, 192 | body: raw, 193 | redirect: 'follow' 194 | }; 195 | 196 | fetch("https://demo.openmrs.org/openmrs/ws/rest/v1/role", requestOptions) 197 | .then(response => response.text()) 198 | .then(result => console.log(result)) 199 | .catch(error => console.log('error', error)); 200 | 201 | ``` 202 | 203 | * To create a role, you need to specify below attributes in the request body. If the user is not logged in to perform this action, a `401 Unauthorized` status is returned. 204 | 205 | ### Attributes 206 | 207 | Parameter | Type | Description 208 | --- | --- | --- 209 | *name* | `String` | Name of the role (Required) 210 | *description* | `String` | Description of the role (Required) 211 | *[privileges](#privilege)* | `Array[] : privileges` | An array of the privilege resource 212 | *[inheritedRoles](#role)* | `Array[] : inheritedRoles` | An array of the inheritedRoles type or UUIDs 213 | 214 | ## Update a role 215 | 216 | ```shell 217 | POST /role/:target_role_uuid 218 | { 219 | "description": "Manages forms and attaches them to the UI" 220 | } 221 | 222 | ``` 223 | 224 | ```java 225 | 226 | OkHttpClient client = new OkHttpClient().newBuilder() 227 | .build(); 228 | MediaType mediaType = MediaType.parse("application/json"); 229 | RequestBody body = RequestBody.create(mediaType, "{\r\n \"description\": \"Manages forms and attaches them to the UI\"\r\n}\r\n"); 230 | Request request = new Request.Builder() 231 | .url("https://demo.openmrs.org/openmrs/ws/rest/v1/role/86f043da-1019-4caf-8db6-d5a472334f58") 232 | .method("POST", body) 233 | .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=") 234 | .addHeader("Content-Type", "application/json") 235 | .addHeader("Cookie", "JSESSIONID=955E778A4F700C5AA9651DAF6FC9DDDA") 236 | .build(); 237 | Response response = client.newCall(request).execute(); 238 | 239 | ``` 240 | 241 | ```javascript 242 | 243 | var requestHeaders = new Headers(); 244 | requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM="); 245 | requestHeaders.append("Content-Type", "application/json"); 246 | requestHeaders.append("Cookie", "JSESSIONID=955E778A4F700C5AA9651DAF6FC9DDDA"); 247 | 248 | var raw = JSON.stringify({"description":"Manages forms and attaches them to the UI"}); 249 | 250 | var requestOptions = { 251 | method: 'POST', 252 | headers: requestHeaders, 253 | body: raw, 254 | redirect: 'follow' 255 | }; 256 | 257 | fetch("https://demo.openmrs.org/openmrs/ws/rest/v1/role/86f043da-1019-4caf-8db6-d5a472334f58", requestOptions) 258 | .then(response => response.text()) 259 | .then(result => console.log(result)) 260 | 261 | 262 | ``` 263 | 264 | * Update a role with given UUID, this method only modifies properties in the request. Returns a `404 Not Found` status if the role does not exist. If the user is not logged in to perform this action, a `401 Unauthorized` status is returned. 265 | 266 | ### Attributes 267 | 268 | Parameter | Type | Description 269 | --- | --- | --- 270 | *name* | `String` | Name of the role (Required) 271 | *description* | `String` | Description of the role (Required) 272 | *[privileges](#privilege)* | `Array[] : privileges` | An array of the privilege resource 273 | *[inheritedRoles](#role)* | `Array[] : inheritedRoles` | An array of the inheritedRoles type or UUIDs 274 | 275 | 276 | ## Delete a role 277 | 278 | > Delete a role 279 | 280 | ```shell 281 | DELETE /role/:target_role_uuid?purge=true 282 | ``` 283 | 284 | ```java 285 | 286 | OkHttpClient client = new OkHttpClient().newBuilder() 287 | .build(); 288 | MediaType mediaType = MediaType.parse("text/plain"); 289 | RequestBody body = RequestBody.create(mediaType, ""); 290 | Request request = new Request.Builder() 291 | .url("https://demo.openmrs.org/openmrs/ws/rest/v1/role/86f043da-1019-4caf-8db6-d5a472334f58?purge=true") 292 | .method("DELETE", body) 293 | .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=") 294 | .addHeader("Cookie", "JSESSIONID=955E778A4F700C5AA9651DAF6FC9DDDA") 295 | .build(); 296 | Response response = client.newCall(request).execute(); 297 | 298 | ``` 299 | 300 | ```javascript 301 | 302 | var requestHeaders = new Headers(); 303 | requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM="); 304 | requestHeaders.append("Cookie", "JSESSIONID=955E778A4F700C5AA9651DAF6FC9DDDA"); 305 | 306 | var requestOptions = { 307 | method: 'DELETE', 308 | headers: requestHeaders, 309 | redirect: 'follow' 310 | }; 311 | 312 | fetch("https://demo.openmrs.org/openmrs/ws/rest/v1/role/86f043da-1019-4caf-8db6-d5a472334f58?purge=true", requestOptions) 313 | .then(response => response.text()) 314 | .then(result => console.log(result)) 315 | .catch(error => console.log('error', error)); 316 | 317 | ``` 318 | 319 | * Delete a role by its UUID. Returns a `404 Not Found` status if the role does not exist. If the user is not logged in to perform this action, a `401 Unauthorized` status is returned. 320 | 321 | ### Query Parameters 322 | 323 | Parameter | Type | Description 324 | --- | --- | --- 325 | *purge* | `Boolean` | must be `true` to delete the role from the system; if `false`, the request will have no effect 326 | 327 | -------------------------------------------------------------------------------- /source/includes/Visit/visit_type.md: -------------------------------------------------------------------------------- 1 | # Visits Type 2 | 3 | ## Visits Type Overview 4 | 5 | * A Visit Type is a name and description of a kind of visit. 6 | 7 | * Every visit has a type. You should create visit types that match how your health site classifies visits, such as "Outpatient," "Hospitalization," "Dental," "Patient Education," or "TB Clinic.". 8 | 9 | * It is mandatory to set up at least one visit type. 10 | 11 | * Visit types will be shown as dropdown options when creating or editing a patient in Registration. 12 | 13 | * Visit types can be added via the OpenMRS admin screen(Administration > Visits > Manage Visit Types) or via SQL scripts. 14 | 15 | ## Available operations for Visits Type 16 | 17 | 1. [List visits types](#list-visits-types) 18 | 2. [Create a visit type](#create-a-visit-type) 19 | 3. [Update a visit type](#update-a-visit-type) 20 | 4. [Delete a visit type](#delete-a-visit-type) 21 | 22 | 23 | ## list visits types 24 | 25 | > list visits types 26 | 27 | ```shell 28 | GET /visittype?q=Facility&v=full 29 | ``` 30 | 31 | ```java 32 | 33 | OkHttpClient client = new OkHttpClient().newBuilder() 34 | .build(); 35 | Request request = new Request.Builder() 36 | .url("/openmrs/ws/rest/v1/visittype?q=Facility&v=full") 37 | .method("GET", null) 38 | .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=") 39 | .addHeader("Cookie", "JSESSIONID=1B06650EB0428F51EC119C909F58327C") 40 | .build(); 41 | Response response = client.newCall(request).execute(); 42 | 43 | ``` 44 | 45 | ```javascript 46 | 47 | var requestHeaders = new Headers(); 48 | requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM="); 49 | requestHeaders.append("Cookie", "JSESSIONID=1B06650EB0428F51EC119C909F58327C"); 50 | 51 | var requestOptions = { 52 | method: 'GET', 53 | headers: requestHeaders, 54 | redirect: 'follow' 55 | }; 56 | 57 | fetch("/openmrs/ws/rest/v1/visittype?q=Facility&v=full", requestOptions) 58 | .then(response => response.text()) 59 | .then(result => console.log(result)) 60 | .catch(error => console.log('error', error)); 61 | 62 | ``` 63 | 64 | >Success Response 65 | 66 | ```response 67 | 68 | { 69 | "results": [ 70 | { 71 | "uuid": "7b0f5697-27e3-40c4-8bae-f4049abfb4ed", 72 | "display": "Facility Visit", 73 | "name": "Facility Visit", 74 | "description": "Patient visits the clinic/hospital (as opposed to a home visit, or telephone contact)", 75 | "retired": false, 76 | "auditInfo": { 77 | "creator": { 78 | "uuid": "A4F30A1B-5EB9-11DF-A648-37A07F9C90FB", 79 | "display": "daemon", 80 | "links": [ 81 | { 82 | "rel": "self", 83 | "uri": "http://qa-refapp.openmrs.org/openmrs/ws/rest/v1/user/A4F30A1B-5EB9-11DF-A648-37A07F9C90FB", 84 | "resourceAlias": "user" 85 | } 86 | ] 87 | }, 88 | "dateCreated": "2013-08-02T00:39:43.000+0000", 89 | "changedBy": { 90 | "uuid": "A4F30A1B-5EB9-11DF-A648-37A07F9C90FB", 91 | "display": "daemon", 92 | "links": [ 93 | { 94 | "rel": "self", 95 | "uri": "http://qa-refapp.openmrs.org/openmrs/ws/rest/v1/user/A4F30A1B-5EB9-11DF-A648-37A07F9C90FB", 96 | "resourceAlias": "user" 97 | } 98 | ] 99 | }, 100 | "dateChanged": "2017-01-18T08:53:57.000+0000" 101 | }, 102 | "links": [ 103 | { 104 | "rel": "self", 105 | "uri": "http://qa-refapp.openmrs.org/openmrs/ws/rest/v1/visittype/7b0f5697-27e3-40c4-8bae-f4049abfb4ed", 106 | "resourceAlias": "visittype" 107 | } 108 | ], 109 | "resourceVersion": "1.9" 110 | } 111 | ] 112 | } 113 | 114 | ``` 115 | 116 | * Quickly filter visit types with a given search query. Returns a `404 Not Found` status if visit type not exists. If the user is not logged in to perform this action, a `401 Unauthorized` status returned. 117 | 118 | ### Query Parameters 119 | 120 | Parameter | Type | Description 121 | --- | --- | --- 122 | *q* | `Search Query` | Display Name of Visit Type. 123 | 124 | ## List visit type by UUID. 125 | 126 | > List visit type by UUID 127 | 128 | ```shell 129 | GET /visittype/:target_visit_type_uuid 130 | ``` 131 | ```java 132 | 133 | OkHttpClient client = new OkHttpClient().newBuilder() 134 | .build(); 135 | Request request = new Request.Builder() 136 | .url("/openmrs/ws/rest/v1/visittype/7b0f5697-27e3-40c4-8bae-f4049abfb4ed") 137 | .method("GET", null) 138 | .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=") 139 | .addHeader("Cookie", "JSESSIONID=1B06650EB0428F51EC119C909F58327C") 140 | .build(); 141 | Response response = client.newCall(request).execute(); 142 | 143 | ``` 144 | 145 | ```javascript 146 | 147 | var requestHeaders = new Headers(); 148 | requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM="); 149 | requestHeaders.append("Cookie", "JSESSIONID=1B06650EB0428F51EC119C909F58327C"); 150 | 151 | var requestOptions = { 152 | method: 'GET', 153 | headers: requestHeaders, 154 | redirect: 'follow' 155 | }; 156 | 157 | fetch("/openmrs/ws/rest/v1/visittype/7b0f5697-27e3-40c4-8bae-f4049abfb4ed", requestOptions) 158 | .then(response => response.text()) 159 | .then(result => console.log(result)) 160 | .catch(error => console.log('error', error)); 161 | 162 | ``` 163 | 164 | * Retrieve a visit type by its UUID. Returns a `404 Not Found` status if visit type not exists. If user not logged in to perform this action, a `401 Unauthorized` status returned. 165 | 166 | ## Create a visit type 167 | 168 | > Create a visit type 169 | 170 | ```shell 171 | POST /visittype 172 | { 173 | "name": "Facility Visit", 174 | "description": "Patient visits the clinic/hospital (as opposed to a home visit, or telephone contact)" 175 | } 176 | ``` 177 | 178 | ```java 179 | 180 | OkHttpClient client = new OkHttpClient().newBuilder() 181 | .build(); 182 | MediaType mediaType = MediaType.parse("application/json"); 183 | RequestBody body = RequestBody.create(mediaType, "{\r\n \"name\": \"Facility Visit\",\r\n \"description\": \"Patient visits the clinic/hospital (as opposed to a home visit, or telephone contact)\"\r\n}\r\n"); 184 | Request request = new Request.Builder() 185 | .url("/openmrs/ws/rest/v1/visittype") 186 | .method("POST", body) 187 | .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=") 188 | .addHeader("Content-Type", "application/json") 189 | .addHeader("Cookie", "JSESSIONID=1B06650EB0428F51EC119C909F58327C") 190 | .build(); 191 | Response response = client.newCall(request).execute(); 192 | 193 | ``` 194 | 195 | 196 | ```javascript 197 | 198 | var requestHeaders = new Headers(); 199 | requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM="); 200 | requestHeaders.append("Content-Type", "application/json"); 201 | requestHeaders.append("Cookie", "JSESSIONID=1B06650EB0428F51EC119C909F58327C"); 202 | 203 | var raw = JSON.stringify({"name":"Facility Visit","description":"Patient visits the clinic/hospital (as opposed to a home visit, or telephone contact)"}); 204 | 205 | var requestOptions = { 206 | method: 'POST', 207 | headers: requestHeaders, 208 | body: raw, 209 | redirect: 'follow' 210 | }; 211 | 212 | fetch("/openmrs/ws/rest/v1/visittype", requestOptions) 213 | .then(response => response.text()) 214 | .then(result => console.log(result)) 215 | .catch(error => console.log('error', error)); 216 | 217 | ``` 218 | 219 | * To Create a visit type, you need to specify below attributes in the request body. If you are not logged in to perform this action, 220 | a `401 Unauthorized` status returned. 221 | 222 | ### Attributes 223 | 224 | Parameter | Type | Description 225 | --- | --- | --- 226 | *name* | `String` | Name of the visit type (Required) 227 | *description* | `String` | Description of the visit type 228 | 229 | 230 | ## Update a visit type 231 | 232 | > Update a visit type 233 | 234 | ```shell 235 | POST /type/:target_visit_type_uuid 236 | { 237 | "name": "Facility Visit", 238 | "description": "Modified description" 239 | } 240 | ``` 241 | 242 | ```java 243 | 244 | OkHttpClient client = new OkHttpClient().newBuilder() 245 | .build(); 246 | MediaType mediaType = MediaType.parse("application/json"); 247 | RequestBody body = RequestBody.create(mediaType, "{\r\n \"name\": \"Facility Visit\",\r\n \"description\": \"Modified description\"\r\n}\r\n"); 248 | Request request = new Request.Builder() 249 | .url("/openmrs/ws/rest/v1/visittype/62e364c3-8eb0-46e9-b420-9463a4efdcc9") 250 | .method("POST", body) 251 | .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=") 252 | .addHeader("Content-Type", "application/json") 253 | .addHeader("Cookie", "JSESSIONID=1B06650EB0428F51EC119C909F58327C") 254 | .build(); 255 | Response response = client.newCall(request).execute(); 256 | 257 | ``` 258 | 259 | ```javascript 260 | 261 | var requestHeaders = new Headers(); 262 | requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM="); 263 | requestHeaders.append("Content-Type", "application/json"); 264 | requestHeaders.append("Cookie", "JSESSIONID=1B06650EB0428F51EC119C909F58327C"); 265 | 266 | var raw = JSON.stringify({"name":"Facility Visit","description":"Modified description"}); 267 | 268 | var requestOptions = { 269 | method: 'POST', 270 | headers: requestHeaders, 271 | body: raw, 272 | redirect: 'follow' 273 | }; 274 | 275 | fetch("/openmrs/ws/rest/v1/visittype/62e364c3-8eb0-46e9-b420-9463a4efdcc9", requestOptions) 276 | .then(response => response.text()) 277 | .then(result => console.log(result)) 278 | .catch(error => console.log('error', error)); 279 | 280 | ``` 281 | 282 | * Update a target visit type with given UUID, this method only modifies properties in the request. Returns a `404 Not Found` 283 | status if visit not exists. If user not logged in to perform this action, a `401 Unauthorized` status returned. 284 | 285 | 286 | ### Attributes 287 | 288 | Parameter | Type | Description 289 | --- | --- | --- 290 | *name* | `String` | Name of the visit type 291 | *description* | `Patient UUID` | Visit type resource UUID 292 | 293 | 294 | ## Delete a visit type 295 | 296 | > Delete a visit type 297 | 298 | ```shell 299 | DELETE /visittype/:target_visit_type_uuid?purge=true 300 | ``` 301 | 302 | ```java 303 | 304 | OkHttpClient client = new OkHttpClient().newBuilder() 305 | .build(); 306 | MediaType mediaType = MediaType.parse("text/plain"); 307 | RequestBody body = RequestBody.create(mediaType, ""); 308 | Request request = new Request.Builder() 309 | .url("/openmrs/ws/rest/v1/visittype/62e364c3-8eb0-46e9-b420-9463a4efdcc9?purge=true") 310 | .method("DELETE", body) 311 | .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=") 312 | .addHeader("Cookie", "JSESSIONID=1B06650EB0428F51EC119C909F58327C") 313 | .build(); 314 | Response response = client.newCall(request).execute(); 315 | ``` 316 | ```javascript 317 | 318 | var requestHeaders = new Headers(); 319 | requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM="); 320 | requestHeaders.append("Cookie", "JSESSIONID=1B06650EB0428F51EC119C909F58327C"); 321 | 322 | var requestOptions = { 323 | method: 'DELETE', 324 | headers: requestHeaders, 325 | redirect: 'follow' 326 | }; 327 | 328 | fetch("/openmrs/ws/rest/v1/visittype/62e364c3-8eb0-46e9-b420-9463a4efdcc9?purge=true", requestOptions) 329 | .then(response => response.text()) 330 | .then(result => console.log(result)) 331 | .catch(error => console.log('error', error)); 332 | 333 | ``` 334 | 335 | * Delete or Retire a target visit type by its UUID. Returns a `404 Not Found` status if visit not exists. If user not logged in to perform this action, a `401 Unauthorized` status returned. 336 | 337 | ### Query Parameters 338 | 339 | Parameter | Type | Description 340 | --- | --- | --- 341 | *purge* | `Boolean` | The resource will be voided/retired unless purge = ‘true’ 342 | 343 | 344 | -------------------------------------------------------------------------------- /source/includes/Visit/visits_configuration.md: -------------------------------------------------------------------------------- 1 | # Visits Configuration 2 | 3 | ## Visits Configuration Overview 4 | 5 | Visits introduce a set of settings related to Visits Behavior. You can retrieve and update this configuration through REST API. 6 | 7 | ## Available operations for Visits Configuration 8 | 9 | 1. [Retrieve Configuration](#retrieve-configuration) 10 | 2. [Update Configuration](#update-configuration) 11 | 12 | ## Retrieve Configuration 13 | 14 | > Retrieve Configuration 15 | 16 | ```shell 17 | GET /visitconfiguration 18 | ``` 19 | 20 | ```java 21 | OkHttpClient client = new OkHttpClient().newBuilder() 22 | .build(); 23 | Request request = new Request.Builder() 24 | .url("/openmrs/ws/rest/v1/visitconfiguration") 25 | .method("GET", null) 26 | .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=") 27 | .addHeader("Cookie", "JSESSIONID=1B06650EB0428F51EC119C909F58327C") 28 | .build(); 29 | Response response = client.newCall(request).execute(); 30 | ``` 31 | 32 | 33 | ```javascript 34 | var requestHeaders = new Headers(); 35 | requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM="); 36 | requestHeaders.append("Cookie", "JSESSIONID=1B06650EB0428F51EC119C909F58327C"); 37 | 38 | var requestOptions = { 39 | method: 'GET', 40 | headers: requestHeaders, 41 | redirect: 'follow' 42 | }; 43 | 44 | fetch("/openmrs/ws/rest/v1/visitconfiguration", requestOptions) 45 | .then(response => response.text()) 46 | .then(result => console.log(result)) 47 | .catch(error => console.log('error', error)); 48 | ``` 49 | 50 | > Success Response 51 | 52 | ```response 53 | { 54 | "encounterVisitsAssignmentHandler": "org.openmrs.api.handler.NoVisitAssignmentHandler", 55 | "enableVisits": true, 56 | "startAutoCloseVisitsTask": true, 57 | "visitTypesToAutoClose": [ 58 | { 59 | "uuid": "48d69339-bb3a-489f-bf23-70e3da9cfc4d", 60 | "display": "Test", 61 | "name": "Test", 62 | "description": null, 63 | "retired": false, 64 | "links": [ 65 | { 66 | "rel": "self", 67 | "uri": "/ws/rest/v1/visittype/48d69339-bb3a-489f-bf23-70e3da9cfc4d", 68 | "resourceAlias": "visittype" 69 | }, 70 | { 71 | "rel": "full", 72 | "uri": "/ws/rest/v1/visittype/48d69339-bb3a-489f-bf23-70e3da9cfc4d?v=full", 73 | "resourceAlias": "visittype" 74 | } 75 | ] 76 | } 77 | ] 78 | } 79 | ``` 80 | 81 | Retrieves current configuration. 82 | 83 | ## Update Configuration 84 | 85 | > Update Configuration 86 | 87 | ```shell 88 | POST /visitconfiguration 89 | { 90 | "enableVisits": true, 91 | "encounterVisitsAssignmentHandler": "org.openmrs.api.handler.NoVisitAssignmentHandler", 92 | "startAutoCloseVisitsTask": true, 93 | "visitTypesToAutoClose": [ 94 | { 95 | "uuid": "48d69339-bb3a-489f-bf23-70e3da9cfc4d" 96 | } 97 | ] 98 | } 99 | ``` 100 | 101 | ```java 102 | OkHttpClient client = new OkHttpClient().newBuilder() 103 | .build(); 104 | MediaType mediaType = MediaType.parse("application/json"); 105 | RequestBody body = RequestBody.create(mediaType, "{\"enableVisits\": true,\"encounterVisitsAssignmentHandler\":\"org.openmrs.api.handler.NoVisitAssignmentHandler\",\"startAutoCloseVisitsTask\": true,\"visitTypesToAutoClose\": [{\"uuid\": \"48d69339-bb3a-489f-bf23-70e3da9cfc4d\"}]}"); 106 | Request request = new Request.Builder() 107 | .url("/openmrs/ws/rest/v1/visitconfiguration") 108 | .method("POST", body) 109 | .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=") 110 | .addHeader("Content-Type", "application/json") 111 | .addHeader("Cookie", "JSESSIONID=1B06650EB0428F51EC119C909F58327C") 112 | .build(); 113 | Response response = client.newCall(request).execute(); 114 | ``` 115 | 116 | ```javascript 117 | var requestHeaders = new Headers(); 118 | requestHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM="); 119 | requestHeaders.append("Content-Type", "application/json"); 120 | requestHeaders.append("Cookie", "JSESSIONID=1B06650EB0428F51EC119C909F58327C"); 121 | 122 | var raw = JSON.stringify({"enableVisits": true,"encounterVisitsAssignmentHandler":"org.openmrs.api.handler.NoVisitAssignmentHandler","startAutoCloseVisitsTask": true,"visitTypesToAutoClose": [{"uuid": "48d69339-bb3a-489f-bf23-70e3da9cfc4d"}]}); 123 | 124 | var requestOptions = { 125 | method: 'POST', 126 | headers: requestHeaders, 127 | body: raw, 128 | redirect: 'follow' 129 | }; 130 | 131 | fetch("/openmrs/ws/rest/v1/visitconfiguration", requestOptions) 132 | .then(response => response.text()) 133 | .then(result => console.log(result)) 134 | .catch(error => console.log('error', error)); 135 | ``` 136 | 137 | Updates current configuration with the following properties: 138 | 139 | ### Attributes 140 | Parameter | Type | Description 141 | --- | --- | --- 142 | *enableVisits* | `Boolean` | Are visits enabled 143 | *encounterVisitsAssignmentHandler* | `String` | Class name of EncounterVisitHandler subclass 144 | *startAutoCloseVisitsTask* | `Boolean` | Should visits be automatically closed 145 | *[visitTypesToAutoClose](#visits-type)* | `Array[]: VisitType` | List of visit types to automatically close. Only UUID field, see an example. 146 | -------------------------------------------------------------------------------- /source/includes/auth.md: -------------------------------------------------------------------------------- 1 | # Authentication 2 | 3 | * Almost every API endpoint(other than the `/session` endpoint) in OpenMRS API requires authentication 4 | in order to interact. 5 | 6 | * Currently, only BASIC authentication is supported. Along with the HTTP request, a request header of 7 | `Authorization: Basic ` needs to be sent. 8 | 9 | * Alternatively, a session token can be used to interact with the API endpoints. 10 | 11 | * For example the base64 encoding of `admin:Admin123` is `YWRtaW46QWRtaW4xMjM=` 12 | 13 | 14 | ## Retrieve session token 15 | 16 | > Retrieve session token 17 | 18 | ```shell 19 | GET /openmrs/ws/rest/v1/session 20 | -H 'Authorization: Basic Auth response.text()) 48 | .then(result => console.log(result)) 49 | .catch(error => console.log('error', error)); 50 | 51 | ``` 52 | 53 | > Success Response 54 | 55 | ```response 56 | { 57 | "sessionId": "2D158E83ACFB788998C7DB495F07C1B9", 58 | "authenticated": true, 59 | "user": { 60 | "uuid": "45ce6c2e-dd5a-11e6-9d9c-0242ac150002", 61 | "display": "admin", 62 | "username": "admin", 63 | "systemId": "admin", 64 | "userProperties": { 65 | "loginAttempts": "0", 66 | "emrapi.lastViewedPatientIds": "508,509,511,512,513,514,515,516,517,510,518,519,520,521,522,523,524,507,44,525" 67 | }, 68 | "person": { 69 | "uuid": "24252571-dd5a-11e6-9d9c-0242ac150002" 70 | }, 71 | "privileges": [], 72 | "roles": [ 73 | { 74 | "uuid": "8d94f852-c2cc-11de-8d13-0010c6dffd0f", 75 | "name": "System Developer" 76 | }, 77 | { 78 | "uuid": "8d94f280-c2cc-11de-8d13-0010c6dffd0f", 79 | "name": "Provider" 80 | } 81 | ] 82 | }, 83 | "locale": "en_GB", 84 | "allowedLocales": [ 85 | "en", 86 | "en_GB", 87 | "es", 88 | "fr", 89 | "it", 90 | "pt" 91 | ], 92 | "sessionLocation": null 93 | } 94 | ``` 95 | 96 | * The session token is retrieved using Basic authentication on the `/session` endpoint. The response will include a `JSESSIONID` in the header. 97 | 98 | 99 | * The `sessionId` token should be passed with all subsequent calls as a cookie named `JSESSIONID`. 100 | 101 | ## Logout User/End session 102 | 103 | > Logout User/End session 104 | 105 | ```shell 106 | DELETE /openmrs/ws/rest/v1/session -H 'Accept: application/json' 107 | -H 'Authorization: Basic Auth' (required to identify the user) 108 | ``` 109 | 110 | ```java 111 | OkHttpClient client = new OkHttpClient().newBuilder().build(); 112 | Request request = new Request.Builder() 113 | .url("/openmrs/ws/rest/v1/session") 114 | .method("DELETE", null) 115 | .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=") 116 | .build(); 117 | Response response = client.newCall(request).execute(); 118 | ``` 119 | 120 | ```javascript 121 | 122 | var myHeaders = new Headers(); 123 | myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM="); 124 | myHeaders.append("Cookie", "JSESSIONID=2D158E83ACFB788998C7DB495F07C1B9"); 125 | 126 | var requestOptions = { 127 | method: 'DELETE', 128 | headers: myHeaders, 129 | redirect: 'follow' 130 | }; 131 | 132 | fetch("/openmrs/ws/rest/v1/session", requestOptions) 133 | .then(response => response.text()) 134 | .then(result => console.log(result)) 135 | .catch(error => console.log('error', error)); 136 | 137 | ``` 138 | 139 | 140 | 141 | ## Changing Password 142 | 143 | > Password change By Admin 144 | 145 | ```shell 146 | POST /openmrs/ws/rest/v1/password/:target_user_uuid 147 | { 148 | "newPassword" : "newPassword" 149 | } 150 | ``` 151 | 152 | ```java 153 | 154 | OkHttpClient client = new OkHttpClient().newBuilder() 155 | .build(); 156 | MediaType mediaType = MediaType.parse("application/json"); 157 | 158 | //password should contain atleast 1 integer 159 | RequestBody body = RequestBody.create(mediaType, "{ \r\n \"newPassword\" : \"password1\"\r\n}"); 160 | Request request = new Request.Builder() 161 | .url("/openmrs/ws/rest/v1/password/45ce6c2e-dd5a-11e6-9d9c-0242ac150002") 162 | .method("POST", body) 163 | .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=") 164 | .addHeader("Content-Type", "application/json") 165 | .build(); 166 | Response response = client.newCall(request).execute(); 167 | } 168 | 169 | ``` 170 | ```javascript 171 | 172 | var myHeaders = new Headers(); 173 | myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM="); 174 | myHeaders.append("Content-Type", "application/json"); 175 | myHeaders.append("Cookie", "JSESSIONID=2D158E83ACFB788998C7DB495F07C1B9"); 176 | 177 | var raw = JSON.stringify({"newPassword":"newPassword1"}); 178 | 179 | var requestOptions = { 180 | method: 'POST', 181 | headers: myHeaders, 182 | body: raw, 183 | redirect: 'follow' 184 | }; 185 | 186 | fetch("/openmrs/ws/rest/v1/password/45ce6c2e-dd5a-11e6-9d9c-0242ac150002", requestOptions) 187 | .then(response => response.text()) 188 | .then(result => console.log(result)) 189 | .catch(error => console.log('error', error)); 190 | 191 | ``` 192 | 193 | 194 | Since version 2.17 of the webservices.rest module: 195 | 196 | * An administrator (with the `EDIT_USER_PASSWORDS` privilege) can change the password for other users by 197 | posting a new password to `/password/:target_user_uuid`. 198 | * The examples returns a `500 Internal server Error` status if we try to change the password associated with the admin user.so we should use a suitable user's UUID. 199 | * The new password must contain atleast one integer. 200 | 201 | > Password change By Users 202 | 203 | ```shell 204 | POST /openmrs/ws/rest/v1/password 205 | { 206 | "oldPassword" : "oldPassword", 207 | "newPassword" : "newPassword" 208 | } 209 | ``` 210 | 211 | ```java 212 | OkHttpClient client = new OkHttpClient().newBuilder().build(); 213 | MediaType mediaType = MediaType.parse("application/json"); 214 | 215 | RequestBody body = RequestBody.create(mediaType, "{\r\n \"oldPassword\" : \"Admin123\",\r\n \"newPassword\" : \"newPassword1\"\r\n}"); 216 | Request request = new Request.Builder() 217 | .url("/openmrs/ws/rest/v1/password") 218 | .method("POST", body) 219 | .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=") 220 | .addHeader("Content-Type", "application/json") 221 | .build(); 222 | Response response = client.newCall(request).execute(); 223 | ``` 224 | 225 | ```javascript 226 | 227 | var myHeaders = new Headers(); 228 | myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM="); 229 | myHeaders.append("Content-Type", "application/json"); 230 | myHeaders.append("Cookie", "JSESSIONID=2D158E83ACFB788998C7DB495F07C1B9"); 231 | 232 | var raw = JSON.stringify({"oldPassword":"Admin123","newPassword":"newPassword1"}); 233 | 234 | var requestOptions = { 235 | method: 'POST', 236 | headers: myHeaders, 237 | body: raw, 238 | redirect: 'follow' 239 | }; 240 | 241 | fetch("/openmrs/ws/rest/v1/password \n", requestOptions) 242 | .then(response => response.text()) 243 | .then(result => console.log(result)) 244 | .catch(error => console.log('error', error)); 245 | 246 | ``` 247 | 248 | 249 | * After authenticating user can change their own password, by posting to `/password`. 250 | * The new password must contain atleast one integer. 251 | 252 | ## Getting all location without authentication 253 | 254 | > Getting all location without authentication 255 | 256 | ```shell 257 | GET /openmrs/ws/rest/v1/location?tag=Login+Location' 258 | ``` 259 | ```java 260 | 261 | OkHttpClient client = new OkHttpClient().newBuilder() 262 | .build(); 263 | Request request = new Request.Builder() 264 | .url("/openmrs/ws/rest/v1/location?tag=Login+Location") 265 | .method("GET", null) 266 | .addHeader("Authorization", "Basic YWRtaW46QWRtaW4xMjM=") 267 | .build(); 268 | Response response = client.newCall(request).execute(); 269 | 270 | ``` 271 | 272 | ```javascript 273 | 274 | var myHeaders = new Headers(); 275 | myHeaders.append("Authorization", "Basic YWRtaW46QWRtaW4xMjM="); 276 | myHeaders.append("Cookie", "JSESSIONID=2D158E83ACFB788998C7DB495F07C1B9"); 277 | 278 | var requestOptions = { 279 | method: 'GET', 280 | headers: myHeaders, 281 | redirect: 'follow' 282 | }; 283 | 284 | fetch("/openmrs/ws/rest/v1/location?tag=Login+Location'\n", requestOptions) 285 | .then(response => response.text()) 286 | .then(result => console.log(result)) 287 | .catch(error => console.log('error', error)); 288 | ``` 289 | 290 | 291 | * While fetching individual locations requires authentication, you can get a list of available locations by passing 292 | the special `tag` "Login Location" as a query parameter. 293 | 294 | 295 | -------------------------------------------------------------------------------- /source/includes/contrib.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | Help us keep this documentation up to date by forking 4 | [this repository](https://github.com/openmrs/openmrs-contrib-rest-api-docs) 5 | and submitting pull requests with improvements or corrections. The quality of our documentation depends on the collective contributions of persons just like you. Thank you for your contributions! 6 | 7 | Our documentation is written in simple 8 | [markdown](https://guides.github.com/features/mastering-markdown/). The markdown pages can be found in the repository under in the subfolder 9 | `source/includes/`. We use [Slate](https://github.com/slatedocs/slate) to convert our markdown into a friendly and searchable format. More details on contributing may be found in the README of our 10 | [repository](https://github.com/openmrs/openmrs-contrib-rest-api-docs). -------------------------------------------------------------------------------- /source/index.html.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: OpenMRS Docs 3 | 4 | language_tabs: 5 | - shell 6 | - java 7 | - javascript 8 | 9 | toc_footers: 10 | - OpenMRS website 11 | - OpenMRS on GitHub 12 | - OpenMRS wiki 13 | - OpenMRS SDK setup guide 14 | 15 | includes: 16 | # - errors 17 | - info 18 | - auth 19 | - User/user 20 | - User/role 21 | - User/privileges 22 | - Person/persons 23 | - Person/person_attribute_type 24 | - Patient/patients 25 | - Patient/patient_identifier_type 26 | - Patient/patient_identifier_source 27 | - Patient/auto_generation_options 28 | - Patient/patient_identifier_log_entry 29 | - Relationships/relationship_type 30 | - Visit/visits 31 | - Visit/visit_type 32 | - Visit/visit_attribute_type 33 | - Visit/visits_configuration 34 | - Location/location 35 | - Location/location_tag 36 | - Location/location_attribute_type 37 | - Encounter/encounter 38 | - Encounter/encounter_type 39 | - Encounter/encounter_role 40 | - Concepts/concept 41 | - Concepts/concept_source 42 | - Concepts/concept_attribute_type 43 | - Concepts/concept_data_type 44 | - Concepts/concept_map_type 45 | - Concepts/concept_reference_term_type 46 | - Concepts/concepts_class 47 | - Concepts/concept_proposal 48 | - Concepts/concept_stop_word 49 | - Drugs/drugs 50 | - Programs/programs 51 | - Programs/program_workflows 52 | - Programs/program_enrollment 53 | - Programs/concept_state_conversions 54 | - Provider/provider 55 | - Provider/provider_attribute_type 56 | - Tasks/tasks 57 | - Observations/obs 58 | - Orders/order 59 | - Orders/order_type 60 | - Forms/Forms 61 | - Forms/field_type 62 | - AddressTemplate/address_template 63 | - Alerts/alerts 64 | - Queue/queue 65 | - Queue/queue_room 66 | - SystemSettings/system_settings 67 | - SystemInformation/system_information 68 | - SystemInformation/loggedin_users 69 | - SearchIndex/search_index 70 | - LocaleAndTheme/locale_and_theme_configuration 71 | - ImplementationId/implementation_id 72 | - AdministrationLinks/administration_links 73 | - DatabaseChanges/database_changes 74 | - EmrApi/emrapi_configuration 75 | - EmrApi/inpatient_admission 76 | - EmrApi/inpatient_request 77 | - contrib 78 | 79 | 80 | search: true 81 | --- 82 | 83 | --------------------------------------------------------------------------------