Update user
curl --request PUT \
--url https://apiweb.mile.app/api/v3/user/{userId} \
--header 'Authorization: Bearer <token>' \
--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 = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', '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 => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'your update name'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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("PUT", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://apiweb.mile.app/api/v3/user/{userId}")
.header("Authorization", "Bearer <token>")
.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::Put.new(url)
request["Authorization"] = 'Bearer <token>'
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."
}User
Update user
This endpoint allows you to update the details of a specific user in the system. The user ID is passed as a path parameter, and the data to be updated is provided in the request body
PUT
/
user
/
{userId}
Update user
curl --request PUT \
--url https://apiweb.mile.app/api/v3/user/{userId} \
--header 'Authorization: Bearer <token>' \
--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 = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', '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 => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'your update name'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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("PUT", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://apiweb.mile.app/api/v3/user/{userId}")
.header("Authorization", "Bearer <token>")
.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::Put.new(url)
request["Authorization"] = 'Bearer <token>'
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."
}Authorizations
Use a valid Bearer token to authenticate.
Path Parameters
The identifier for the user that generated by system. Example: 621dd813eb3ebf16b94d6969
Body
application/json
The name of user. Example: Jhon doe
The email of user.
Example: example@mile.app
The phone number of user.
Example: +628123456789
The hub id of user.
Example: ['621dd813eb3ebf16b94d6969','621dd813eb3ebf16b94d6968']
The team id of user. If you set empty array, it will assigned to all team.
Example: ['621dd813eb3ebf16b94d6969','621dd813eb3ebf16b94d6968']
Response
OK
The response is of type object.
⌘I