Skip to main content
PATCH
/
user
/
{userId}
Update partially user by ID
curl --request PATCH \
  --url https://apiweb.mile.app/api/v3/user/{userId} \
  --header 'Content-Type: application/json' \
  --data '
{
  "name": "your update name"
}
'
import requests

url = "https://apiweb.mile.app/api/v3/user/{userId}"

payload = { "name": "your update name" }
headers = {"Content-Type": "application/json"}

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

print(response.text)
const options = {
method: 'PATCH',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({name: 'your update name'})
};

fetch('https://apiweb.mile.app/api/v3/user/{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://apiweb.mile.app/api/v3/user/{userId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'your update name'
]),
CURLOPT_HTTPHEADER => [
"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://apiweb.mile.app/api/v3/user/{userId}"

payload := strings.NewReader("{\n \"name\": \"your update name\"\n}")

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

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.patch("https://apiweb.mile.app/api/v3/user/{userId}")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"your update name\"\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://apiweb.mile.app/api/v3/user/{userId}")

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

request = Net::HTTP::Patch.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"your update name\"\n}"

response = http.request(request)
puts response.read_body
{
  "title": "newExampleUsers",
  "example": {
    "status": true,
    "data": {
      "_id": "65c1f4eeca7c4816d94587b7",
      "name": "Example",
      "email": "example@mile.app",
      "provider": "web",
      "hubId": [
        "65c1f68ea735b522d370ea22",
        "65c1f7b800da624e7267a822",
        "65cf10ace3103030040ad152",
        "65c1f79069b4a9333c5a3d12",
        "6661404dfe5cf5096220cb42",
        "65d2d821035413251965f242"
      ],
      "organizationId": "65c1f4eeca7c4816d94587b2",
      "status": "active",
      "lastLogin": "2024-06-18T03:54:47+00:00",
      "roleId": "65c1f4eeca7c4816d94587b3",
      "activationCode": "5dc25a36e280ba34ef6dfe1f54dcb5d6",
      "onboardingStep": [],
      "teamId": [],
      "updatedTime": "2024-06-18T04:42:04+00:00",
      "createdTime": "2024-02-06T08:59:26+00:00",
      "phoneNumber": null,
      "dynamicVisitTime": []
    },
    "message": "Data has been updated successfully.",
    "statusCode": 200
  }
}
{
"status": false,
"message": "Data not found"
}
{
"status": false,
"message": "Internal server error, please contact support@mile.app."
}

Path Parameters

userId
string
required

The identifier for the user that generated by system. Example: 621dd813eb3ebf16b94d6969

Body

application/json
name
string

The name of user. Example: Jhon doe

email
string

The email of user. Example: example@mile.app

phoneNumber
string

The phone number of user. Example: +628123456789

Response

OK

The response is of type object.