users
Mettre à jour les préférences d'un utilisateur délégué
Met à jour les préférences du sujet utilisateur délégué résolu via header.
Mettre à jour les préférences d'un utilisateur délégué
curl --request PUT \
--url https://partner-api.marko.fr/v1/users/me/preferences \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"preferences": {
"locale": "fr"
},
"alert_budget_daily": 8
}
'import requests
url = "https://partner-api.marko.fr/v1/users/me/preferences"
payload = {
"preferences": { "locale": "fr" },
"alert_budget_daily": 8
}
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({preferences: {locale: 'fr'}, alert_budget_daily: 8})
};
fetch('https://partner-api.marko.fr/v1/users/me/preferences', 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://partner-api.marko.fr/v1/users/me/preferences",
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([
'preferences' => [
'locale' => 'fr'
],
'alert_budget_daily' => 8
]),
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://partner-api.marko.fr/v1/users/me/preferences"
payload := strings.NewReader("{\n \"preferences\": {\n \"locale\": \"fr\"\n },\n \"alert_budget_daily\": 8\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://partner-api.marko.fr/v1/users/me/preferences")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"preferences\": {\n \"locale\": \"fr\"\n },\n \"alert_budget_daily\": 8\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://partner-api.marko.fr/v1/users/me/preferences")
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 \"preferences\": {\n \"locale\": \"fr\"\n },\n \"alert_budget_daily\": 8\n}"
response = http.request(request)
puts response.read_body{
"user_id": "usr_001",
"preferences": {
"locale": "fr"
},
"alert_budget_daily": 8
}{
"type": "about:blank",
"title": "Unauthorized",
"status": 401,
"detail": "A valid bearer token is required.",
"request_id": "req_example_partner_call"
}{
"type": "about:blank",
"title": "Forbidden",
"status": 403,
"detail": "The API key does not allow this operation.",
"request_id": "req_example_partner_call"
}{
"type": "about:blank",
"title": "Unprocessable Content",
"status": 422,
"detail": "The request payload or parameters are invalid.",
"request_id": "req_example_partner_call"
}{
"type": "about:blank",
"title": "Too Many Requests",
"status": 429,
"detail": "The request rate limit was exceeded.",
"request_id": "req_example_partner_call"
}{
"type": "about:blank",
"title": "Internal Server Error",
"status": 500,
"detail": "An unexpected server error occurred.",
"request_id": "req_example_partner_call"
}Authorizations
Use the access_token returned by POST /v1/auth/token. Do not send the raw API secret on business endpoints.
Headers
Partner-generated correlation identifier echoed in logs and error payloads.
Body
application/json
The body is of type object.
Response
Successful response
⌘I
Mettre à jour les préférences d'un utilisateur délégué
curl --request PUT \
--url https://partner-api.marko.fr/v1/users/me/preferences \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"preferences": {
"locale": "fr"
},
"alert_budget_daily": 8
}
'import requests
url = "https://partner-api.marko.fr/v1/users/me/preferences"
payload = {
"preferences": { "locale": "fr" },
"alert_budget_daily": 8
}
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({preferences: {locale: 'fr'}, alert_budget_daily: 8})
};
fetch('https://partner-api.marko.fr/v1/users/me/preferences', 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://partner-api.marko.fr/v1/users/me/preferences",
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([
'preferences' => [
'locale' => 'fr'
],
'alert_budget_daily' => 8
]),
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://partner-api.marko.fr/v1/users/me/preferences"
payload := strings.NewReader("{\n \"preferences\": {\n \"locale\": \"fr\"\n },\n \"alert_budget_daily\": 8\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://partner-api.marko.fr/v1/users/me/preferences")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"preferences\": {\n \"locale\": \"fr\"\n },\n \"alert_budget_daily\": 8\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://partner-api.marko.fr/v1/users/me/preferences")
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 \"preferences\": {\n \"locale\": \"fr\"\n },\n \"alert_budget_daily\": 8\n}"
response = http.request(request)
puts response.read_body{
"user_id": "usr_001",
"preferences": {
"locale": "fr"
},
"alert_budget_daily": 8
}{
"type": "about:blank",
"title": "Unauthorized",
"status": 401,
"detail": "A valid bearer token is required.",
"request_id": "req_example_partner_call"
}{
"type": "about:blank",
"title": "Forbidden",
"status": 403,
"detail": "The API key does not allow this operation.",
"request_id": "req_example_partner_call"
}{
"type": "about:blank",
"title": "Unprocessable Content",
"status": 422,
"detail": "The request payload or parameters are invalid.",
"request_id": "req_example_partner_call"
}{
"type": "about:blank",
"title": "Too Many Requests",
"status": 429,
"detail": "The request rate limit was exceeded.",
"request_id": "req_example_partner_call"
}{
"type": "about:blank",
"title": "Internal Server Error",
"status": 500,
"detail": "An unexpected server error occurred.",
"request_id": "req_example_partner_call"
}