Update user

Perform an UPDATE request to the Authentication endpoint to update the user data.

Only the owner of the data can update it. This mechanism was implemented to prevent other authenticated users from updating other users data.

Note that Authentication endpoints are secured by default, so you have to include the Access token in the request.


// set this property in the request options:
{ credentials: 'include' } // using fetch
{ withCredentials: true } // using axios

Request data#

HTTP method: PUT

URL format: https://baseUrl/versionNumber/customEndpointRoute/userEndpoint?key=apiKey&uniqueId=uniqueId[&dataOnly=true]



Request Cookie#

yawe_access_tokenYesThis token is obtained when doing a login. To automatically include it in the request you need to set the following property:
// using fetch
{ credentials: 'include' }
// using axios
{ withCredentials: true }

Request Parameters#

The following table describes the Request parameters.

baseUrlBase url for calling the API.

Value: app.yawe.dev/api

versionNumberService version.

Value: The current value is 1.

customEndpointRouteThe route which identifies custom endpoints.

Default value: ce

userEndpointThe endpoint name generated by the user.

Value: the name created at https://app.yawe.dev

keyThe API Key of the project.Yes
uniqueIdThe identifier of the record to be updated.Yes
dataOnlyIf used, the endpoint response will be the POST body, without additional information such as ‘uniqueId’.

Value: true

masterKeyOverrides the need for Access tokens or restrictions applied to Authentication endpoints.

Don't use this key in your client application.

For more information please refer to projects.

Value: the masterKey created at https://app.yawe.dev.

strategyA strategy allows you to choose how the data is updated.

  • force - (default) replaces the content regardless of the type.
  • merge - merges objects, it only works with JSON.
  • replace - replaces the entire content, types must be the same.
Remember that, in authentication endpoints, username and password are required fields. If after the update these values are not present the endpoint will return an error.

Response data#

Error codes#

Error codeDescription
400Possible reasons:
  • Endpoint or API Key not valid.
  • Wrong Content-Type, it only accepts "text/plain" or "application/json".
  • Empty Request body.
  • uniqueId is not present in the URL.
  • No record was found.
  • username or password are not present in the request body.
  • User is not the owner of the data.
401Possible reasons:
  • Missing Access Token.
  • Invalid credentials.
  • Token expired.
  • No user found.
403Missing API Key, not allowed origin or disallowed request without orign.

Successful response#

The new data in the record.


uniqueId: "3f38bf9e1bb54d2396d1f1b8fbba1630",
data: { username: "usernameeee" },
createdAt: "2020-12-27T10:58:45.000Z",
updatedAt: "2020-12-27T10:58:45.000Z"