Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RESTWS-902: Reset Password Rest endpoint documentation #174

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions source/includes/auth.md
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,55 @@ fetch("/openmrs/ws/rest/v1/password \n", requestOptions)
* After authenticating user can change their own password, by posting to `/password`.
* The new password must contain atleast one integer.

## Reset Password
* Reset password API endpoint is only used when the system user doesn't remember the required password

> Reset Password

```shell
POST /openmrs/ws/rest/v1/passwordreset
{
"usernameOrEmail" : "demoUser"
}
```

```java

OkHttpClient client = new OkHttpClient().newBuilder().build();
MediaType mediaType = MediaType.parse("application/json");

RequestBody body = RequestBody.create(mediaType, "{\r\n \"usernameOrEmail\" : \"demoUser\"}");
Request request = new Request.Builder()
.url("/openmrs/ws/rest/v1/passwordreset")
.method("POST", body)
.addHeader("Content-Type", "application/json")
.build();
Response response = client.newCall(request).execute();

```

```javascript

var myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Cookie", "JSESSIONID=2D158E83ACFB788998C7DB495F07C1B9");

var raw = JSON.stringify({"usernameOrEmail":"demoUser"});

var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};

fetch("/openmrs/ws/rest/v1/passwordreset \n", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
```
* After verification of the provided username or email, Then user will receive an email containing password change link.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The above needs some improvement.


## Getting all location without authentication

> Getting all location without authentication
Expand Down