Skip to main content
PUT
/
v1
/
users
/
{userId}
Update user
curl --request PUT \
  --url https://wmc.wiremockapi.cloud/v1/users/{userId} \
  --header 'Authorization: <api-key>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "user": {
    "emailAddress": "docs@example.com",
    "marketingOptIn": false
  }
}
'
import requests

url = "https://wmc.wiremockapi.cloud/v1/users/{userId}"

payload = { "user": {
"emailAddress": "docs@example.com",
"marketingOptIn": False
} }
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}

response = requests.put(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'PUT',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({user: {emailAddress: 'docs@example.com', marketingOptIn: false}})
};

fetch('https://wmc.wiremockapi.cloud/v1/users/{userId}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://wmc.wiremockapi.cloud/v1/users/{userId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'user' => [
'emailAddress' => 'docs@example.com',
'marketingOptIn' => false
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"strings"
"net/http"
"io"
)

func main() {

url := "https://wmc.wiremockapi.cloud/v1/users/{userId}"

payload := strings.NewReader("{\n \"user\": {\n \"emailAddress\": \"docs@example.com\",\n \"marketingOptIn\": false\n }\n}")

req, _ := http.NewRequest("PUT", url, payload)

req.Header.Add("Authorization", "<api-key>")
req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.put("https://wmc.wiremockapi.cloud/v1/users/{userId}")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"user\": {\n \"emailAddress\": \"docs@example.com\",\n \"marketingOptIn\": false\n }\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://wmc.wiremockapi.cloud/v1/users/{userId}")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Put.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"user\": {\n \"emailAddress\": \"docs@example.com\",\n \"marketingOptIn\": false\n }\n}"

response = http.request(request)
puts response.read_body
{
  "user": {
    "id": "9gd5l",
    "aclObject": "4kg32",
    "username": "docs@example.com",
    "apiKey": "3b35fdee8ff9cf5055d062c28675ee22",
    "avatarUrl": "https://s.gravatar.com/avatar/0dc7361faa5dcde8ee7789f06074bb30?s=480&r=pg&d=https%3A%2F%2Fcdn.auth0.com%2Favatars%2Fdo.png",
    "emailAddress": "docs@example.com",
    "marketingOptIn": true,
    "signupDate": "2024-08-23T20:15:32.289889Z",
    "idpUserId": "auth0|66c8ede29a4b3267bd1c4c42",
    "userHash": "47f058ba304b4e3988f285e8b8f6b37b288fbe93c343578ce2deb37c47a24289",
    "links": {
      "self": "/v1/users/9gd5l",
      "features": "/v1/users/9gd5l/features",
      "progress": "/v1/users/9gd5l/progress",
      "teams": "/v1/users/9gd5l/teams",
      "mockApis": "/v1/users/9gd5l/apis",
      "apiTemplateCatalogues": "/v1/users/9gd5l/api-template-catalogues",
      "apiTemplates": "/v1/users/9gd5l/api-templates",
      "dataSources": "/v1/users/9gd5l/data-sources",
      "keys": "/v1/users/9gd5l/jwks",
      "organisation": "/v1/organisations/mgk7g",
      "aclSubject": "/v1/acl/subjects/9gd5l",
      "aclObject": "/v1/acl/objects/4kg32"
    },
    "hasNativeIdp": true,
    "aclSubject": "9gd5l"
  }
}
"Credentials are required to access this resource."
{
"errors": [
{
"title": "Forbidden",
"source": {}
}
]
}
{
"errors": [
{
"title": "Invalid JSON",
"detail": "json pointer /mockApi not present; it is required and must have json type object",
"source": {}
}
]
}

Authorizations

Authorization
string
header
required

Your API key prefixed by 'Token '

Path Parameters

userId
string
required

Body

application/json
user
object
required

Response

200 response

user
object
required