Appwrite
PUT
Complete Email Verification
{{baseUrl}}/account/verification
HEADERS
X-Appwrite-JWT
{{apiKey}}
BODY json
{
"secret": "",
"userId": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/account/verification");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-appwrite-jwt: {{apiKey}}");
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"secret\": \"\",\n \"userId\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/account/verification" {:headers {:x-appwrite-jwt "{{apiKey}}"}
:content-type :json
:form-params {:secret ""
:userId ""}})
require "http/client"
url = "{{baseUrl}}/account/verification"
headers = HTTP::Headers{
"x-appwrite-jwt" => "{{apiKey}}"
"content-type" => "application/json"
}
reqBody = "{\n \"secret\": \"\",\n \"userId\": \"\"\n}"
response = HTTP::Client.put url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Put,
RequestUri = new Uri("{{baseUrl}}/account/verification"),
Headers =
{
{ "x-appwrite-jwt", "{{apiKey}}" },
},
Content = new StringContent("{\n \"secret\": \"\",\n \"userId\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/account/verification");
var request = new RestRequest("", Method.Put);
request.AddHeader("x-appwrite-jwt", "{{apiKey}}");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"secret\": \"\",\n \"userId\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/account/verification"
payload := strings.NewReader("{\n \"secret\": \"\",\n \"userId\": \"\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("x-appwrite-jwt", "{{apiKey}}")
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
PUT /baseUrl/account/verification HTTP/1.1
X-Appwrite-Jwt: {{apiKey}}
Content-Type: application/json
Host: example.com
Content-Length: 34
{
"secret": "",
"userId": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/account/verification")
.setHeader("x-appwrite-jwt", "{{apiKey}}")
.setHeader("content-type", "application/json")
.setBody("{\n \"secret\": \"\",\n \"userId\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/account/verification"))
.header("x-appwrite-jwt", "{{apiKey}}")
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"secret\": \"\",\n \"userId\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"secret\": \"\",\n \"userId\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/account/verification")
.put(body)
.addHeader("x-appwrite-jwt", "{{apiKey}}")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/account/verification")
.header("x-appwrite-jwt", "{{apiKey}}")
.header("content-type", "application/json")
.body("{\n \"secret\": \"\",\n \"userId\": \"\"\n}")
.asString();
const data = JSON.stringify({
secret: '',
userId: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/account/verification');
xhr.setRequestHeader('x-appwrite-jwt', '{{apiKey}}');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/account/verification',
headers: {'x-appwrite-jwt': '{{apiKey}}', 'content-type': 'application/json'},
data: {secret: '', userId: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/account/verification';
const options = {
method: 'PUT',
headers: {'x-appwrite-jwt': '{{apiKey}}', 'content-type': 'application/json'},
body: '{"secret":"","userId":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/account/verification',
method: 'PUT',
headers: {
'x-appwrite-jwt': '{{apiKey}}',
'content-type': 'application/json'
},
processData: false,
data: '{\n "secret": "",\n "userId": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"secret\": \"\",\n \"userId\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/account/verification")
.put(body)
.addHeader("x-appwrite-jwt", "{{apiKey}}")
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'PUT',
hostname: 'example.com',
port: null,
path: '/baseUrl/account/verification',
headers: {
'x-appwrite-jwt': '{{apiKey}}',
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({secret: '', userId: ''}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/account/verification',
headers: {'x-appwrite-jwt': '{{apiKey}}', 'content-type': 'application/json'},
body: {secret: '', userId: ''},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('PUT', '{{baseUrl}}/account/verification');
req.headers({
'x-appwrite-jwt': '{{apiKey}}',
'content-type': 'application/json'
});
req.type('json');
req.send({
secret: '',
userId: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'PUT',
url: '{{baseUrl}}/account/verification',
headers: {'x-appwrite-jwt': '{{apiKey}}', 'content-type': 'application/json'},
data: {secret: '', userId: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/account/verification';
const options = {
method: 'PUT',
headers: {'x-appwrite-jwt': '{{apiKey}}', 'content-type': 'application/json'},
body: '{"secret":"","userId":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-appwrite-jwt": @"{{apiKey}}",
@"content-type": @"application/json" };
NSDictionary *parameters = @{ @"secret": @"",
@"userId": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/account/verification"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"PUT"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/account/verification" in
let headers = Header.add_list (Header.init ()) [
("x-appwrite-jwt", "{{apiKey}}");
("content-type", "application/json");
] in
let body = Cohttp_lwt_body.of_string "{\n \"secret\": \"\",\n \"userId\": \"\"\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/account/verification",
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([
'secret' => '',
'userId' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json",
"x-appwrite-jwt: {{apiKey}}"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('PUT', '{{baseUrl}}/account/verification', [
'body' => '{
"secret": "",
"userId": ""
}',
'headers' => [
'content-type' => 'application/json',
'x-appwrite-jwt' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/account/verification');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'x-appwrite-jwt' => '{{apiKey}}',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'secret' => '',
'userId' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'secret' => '',
'userId' => ''
]));
$request->setRequestUrl('{{baseUrl}}/account/verification');
$request->setRequestMethod('PUT');
$request->setBody($body);
$request->setHeaders([
'x-appwrite-jwt' => '{{apiKey}}',
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-appwrite-jwt", "{{apiKey}}")
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/account/verification' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"secret": "",
"userId": ""
}'
$headers=@{}
$headers.Add("x-appwrite-jwt", "{{apiKey}}")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/account/verification' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"secret": "",
"userId": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"secret\": \"\",\n \"userId\": \"\"\n}"
headers = {
'x-appwrite-jwt': "{{apiKey}}",
'content-type': "application/json"
}
conn.request("PUT", "/baseUrl/account/verification", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/account/verification"
payload = {
"secret": "",
"userId": ""
}
headers = {
"x-appwrite-jwt": "{{apiKey}}",
"content-type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/account/verification"
payload <- "{\n \"secret\": \"\",\n \"userId\": \"\"\n}"
encode <- "json"
response <- VERB("PUT", url, body = payload, add_headers('x-appwrite-jwt' = '{{apiKey}}'), content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/account/verification")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["x-appwrite-jwt"] = '{{apiKey}}'
request["content-type"] = 'application/json'
request.body = "{\n \"secret\": \"\",\n \"userId\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.put('/baseUrl/account/verification') do |req|
req.headers['x-appwrite-jwt'] = '{{apiKey}}'
req.body = "{\n \"secret\": \"\",\n \"userId\": \"\"\n}"
end
puts response.status
puts response.body
use std::str::FromStr;
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/account/verification";
let payload = json!({
"secret": "",
"userId": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-appwrite-jwt", "{{apiKey}}".parse().unwrap());
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("PUT").unwrap(), url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request PUT \
--url {{baseUrl}}/account/verification \
--header 'content-type: application/json' \
--header 'x-appwrite-jwt: {{apiKey}}' \
--data '{
"secret": "",
"userId": ""
}'
echo '{
"secret": "",
"userId": ""
}' | \
http PUT {{baseUrl}}/account/verification \
content-type:application/json \
x-appwrite-jwt:'{{apiKey}}'
wget --quiet \
--method PUT \
--header 'x-appwrite-jwt: {{apiKey}}' \
--header 'content-type: application/json' \
--body-data '{\n "secret": "",\n "userId": ""\n}' \
--output-document \
- {{baseUrl}}/account/verification
import Foundation
let headers = [
"x-appwrite-jwt": "{{apiKey}}",
"content-type": "application/json"
]
let parameters = [
"secret": "",
"userId": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/account/verification")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PUT
Complete Password Recovery
{{baseUrl}}/account/recovery
HEADERS
X-Appwrite-JWT
{{apiKey}}
BODY json
{
"password": "",
"passwordAgain": "",
"secret": "",
"userId": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/account/recovery");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-appwrite-jwt: {{apiKey}}");
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"password\": \"\",\n \"passwordAgain\": \"\",\n \"secret\": \"\",\n \"userId\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/account/recovery" {:headers {:x-appwrite-jwt "{{apiKey}}"}
:content-type :json
:form-params {:password ""
:passwordAgain ""
:secret ""
:userId ""}})
require "http/client"
url = "{{baseUrl}}/account/recovery"
headers = HTTP::Headers{
"x-appwrite-jwt" => "{{apiKey}}"
"content-type" => "application/json"
}
reqBody = "{\n \"password\": \"\",\n \"passwordAgain\": \"\",\n \"secret\": \"\",\n \"userId\": \"\"\n}"
response = HTTP::Client.put url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Put,
RequestUri = new Uri("{{baseUrl}}/account/recovery"),
Headers =
{
{ "x-appwrite-jwt", "{{apiKey}}" },
},
Content = new StringContent("{\n \"password\": \"\",\n \"passwordAgain\": \"\",\n \"secret\": \"\",\n \"userId\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/account/recovery");
var request = new RestRequest("", Method.Put);
request.AddHeader("x-appwrite-jwt", "{{apiKey}}");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"password\": \"\",\n \"passwordAgain\": \"\",\n \"secret\": \"\",\n \"userId\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/account/recovery"
payload := strings.NewReader("{\n \"password\": \"\",\n \"passwordAgain\": \"\",\n \"secret\": \"\",\n \"userId\": \"\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("x-appwrite-jwt", "{{apiKey}}")
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
PUT /baseUrl/account/recovery HTTP/1.1
X-Appwrite-Jwt: {{apiKey}}
Content-Type: application/json
Host: example.com
Content-Length: 75
{
"password": "",
"passwordAgain": "",
"secret": "",
"userId": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/account/recovery")
.setHeader("x-appwrite-jwt", "{{apiKey}}")
.setHeader("content-type", "application/json")
.setBody("{\n \"password\": \"\",\n \"passwordAgain\": \"\",\n \"secret\": \"\",\n \"userId\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/account/recovery"))
.header("x-appwrite-jwt", "{{apiKey}}")
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"password\": \"\",\n \"passwordAgain\": \"\",\n \"secret\": \"\",\n \"userId\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"password\": \"\",\n \"passwordAgain\": \"\",\n \"secret\": \"\",\n \"userId\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/account/recovery")
.put(body)
.addHeader("x-appwrite-jwt", "{{apiKey}}")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/account/recovery")
.header("x-appwrite-jwt", "{{apiKey}}")
.header("content-type", "application/json")
.body("{\n \"password\": \"\",\n \"passwordAgain\": \"\",\n \"secret\": \"\",\n \"userId\": \"\"\n}")
.asString();
const data = JSON.stringify({
password: '',
passwordAgain: '',
secret: '',
userId: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/account/recovery');
xhr.setRequestHeader('x-appwrite-jwt', '{{apiKey}}');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/account/recovery',
headers: {'x-appwrite-jwt': '{{apiKey}}', 'content-type': 'application/json'},
data: {password: '', passwordAgain: '', secret: '', userId: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/account/recovery';
const options = {
method: 'PUT',
headers: {'x-appwrite-jwt': '{{apiKey}}', 'content-type': 'application/json'},
body: '{"password":"","passwordAgain":"","secret":"","userId":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/account/recovery',
method: 'PUT',
headers: {
'x-appwrite-jwt': '{{apiKey}}',
'content-type': 'application/json'
},
processData: false,
data: '{\n "password": "",\n "passwordAgain": "",\n "secret": "",\n "userId": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"password\": \"\",\n \"passwordAgain\": \"\",\n \"secret\": \"\",\n \"userId\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/account/recovery")
.put(body)
.addHeader("x-appwrite-jwt", "{{apiKey}}")
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'PUT',
hostname: 'example.com',
port: null,
path: '/baseUrl/account/recovery',
headers: {
'x-appwrite-jwt': '{{apiKey}}',
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({password: '', passwordAgain: '', secret: '', userId: ''}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/account/recovery',
headers: {'x-appwrite-jwt': '{{apiKey}}', 'content-type': 'application/json'},
body: {password: '', passwordAgain: '', secret: '', userId: ''},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('PUT', '{{baseUrl}}/account/recovery');
req.headers({
'x-appwrite-jwt': '{{apiKey}}',
'content-type': 'application/json'
});
req.type('json');
req.send({
password: '',
passwordAgain: '',
secret: '',
userId: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'PUT',
url: '{{baseUrl}}/account/recovery',
headers: {'x-appwrite-jwt': '{{apiKey}}', 'content-type': 'application/json'},
data: {password: '', passwordAgain: '', secret: '', userId: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/account/recovery';
const options = {
method: 'PUT',
headers: {'x-appwrite-jwt': '{{apiKey}}', 'content-type': 'application/json'},
body: '{"password":"","passwordAgain":"","secret":"","userId":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-appwrite-jwt": @"{{apiKey}}",
@"content-type": @"application/json" };
NSDictionary *parameters = @{ @"password": @"",
@"passwordAgain": @"",
@"secret": @"",
@"userId": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/account/recovery"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"PUT"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/account/recovery" in
let headers = Header.add_list (Header.init ()) [
("x-appwrite-jwt", "{{apiKey}}");
("content-type", "application/json");
] in
let body = Cohttp_lwt_body.of_string "{\n \"password\": \"\",\n \"passwordAgain\": \"\",\n \"secret\": \"\",\n \"userId\": \"\"\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/account/recovery",
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([
'password' => '',
'passwordAgain' => '',
'secret' => '',
'userId' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json",
"x-appwrite-jwt: {{apiKey}}"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('PUT', '{{baseUrl}}/account/recovery', [
'body' => '{
"password": "",
"passwordAgain": "",
"secret": "",
"userId": ""
}',
'headers' => [
'content-type' => 'application/json',
'x-appwrite-jwt' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/account/recovery');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'x-appwrite-jwt' => '{{apiKey}}',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'password' => '',
'passwordAgain' => '',
'secret' => '',
'userId' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'password' => '',
'passwordAgain' => '',
'secret' => '',
'userId' => ''
]));
$request->setRequestUrl('{{baseUrl}}/account/recovery');
$request->setRequestMethod('PUT');
$request->setBody($body);
$request->setHeaders([
'x-appwrite-jwt' => '{{apiKey}}',
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-appwrite-jwt", "{{apiKey}}")
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/account/recovery' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"password": "",
"passwordAgain": "",
"secret": "",
"userId": ""
}'
$headers=@{}
$headers.Add("x-appwrite-jwt", "{{apiKey}}")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/account/recovery' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"password": "",
"passwordAgain": "",
"secret": "",
"userId": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"password\": \"\",\n \"passwordAgain\": \"\",\n \"secret\": \"\",\n \"userId\": \"\"\n}"
headers = {
'x-appwrite-jwt': "{{apiKey}}",
'content-type': "application/json"
}
conn.request("PUT", "/baseUrl/account/recovery", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/account/recovery"
payload = {
"password": "",
"passwordAgain": "",
"secret": "",
"userId": ""
}
headers = {
"x-appwrite-jwt": "{{apiKey}}",
"content-type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/account/recovery"
payload <- "{\n \"password\": \"\",\n \"passwordAgain\": \"\",\n \"secret\": \"\",\n \"userId\": \"\"\n}"
encode <- "json"
response <- VERB("PUT", url, body = payload, add_headers('x-appwrite-jwt' = '{{apiKey}}'), content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/account/recovery")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["x-appwrite-jwt"] = '{{apiKey}}'
request["content-type"] = 'application/json'
request.body = "{\n \"password\": \"\",\n \"passwordAgain\": \"\",\n \"secret\": \"\",\n \"userId\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.put('/baseUrl/account/recovery') do |req|
req.headers['x-appwrite-jwt'] = '{{apiKey}}'
req.body = "{\n \"password\": \"\",\n \"passwordAgain\": \"\",\n \"secret\": \"\",\n \"userId\": \"\"\n}"
end
puts response.status
puts response.body
use std::str::FromStr;
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/account/recovery";
let payload = json!({
"password": "",
"passwordAgain": "",
"secret": "",
"userId": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-appwrite-jwt", "{{apiKey}}".parse().unwrap());
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("PUT").unwrap(), url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request PUT \
--url {{baseUrl}}/account/recovery \
--header 'content-type: application/json' \
--header 'x-appwrite-jwt: {{apiKey}}' \
--data '{
"password": "",
"passwordAgain": "",
"secret": "",
"userId": ""
}'
echo '{
"password": "",
"passwordAgain": "",
"secret": "",
"userId": ""
}' | \
http PUT {{baseUrl}}/account/recovery \
content-type:application/json \
x-appwrite-jwt:'{{apiKey}}'
wget --quiet \
--method PUT \
--header 'x-appwrite-jwt: {{apiKey}}' \
--header 'content-type: application/json' \
--body-data '{\n "password": "",\n "passwordAgain": "",\n "secret": "",\n "userId": ""\n}' \
--output-document \
- {{baseUrl}}/account/recovery
import Foundation
let headers = [
"x-appwrite-jwt": "{{apiKey}}",
"content-type": "application/json"
]
let parameters = [
"password": "",
"passwordAgain": "",
"secret": "",
"userId": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/account/recovery")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
Create Account JWT
{{baseUrl}}/account/jwt
HEADERS
X-Appwrite-Project
{{apiKey}}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/account/jwt");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-appwrite-project: {{apiKey}}");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/account/jwt" {:headers {:x-appwrite-project "{{apiKey}}"}})
require "http/client"
url = "{{baseUrl}}/account/jwt"
headers = HTTP::Headers{
"x-appwrite-project" => "{{apiKey}}"
}
response = HTTP::Client.post url, headers: headers
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/account/jwt"),
Headers =
{
{ "x-appwrite-project", "{{apiKey}}" },
},
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/account/jwt");
var request = new RestRequest("", Method.Post);
request.AddHeader("x-appwrite-project", "{{apiKey}}");
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/account/jwt"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("x-appwrite-project", "{{apiKey}}")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/account/jwt HTTP/1.1
X-Appwrite-Project: {{apiKey}}
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/account/jwt")
.setHeader("x-appwrite-project", "{{apiKey}}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/account/jwt"))
.header("x-appwrite-project", "{{apiKey}}")
.method("POST", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/account/jwt")
.post(null)
.addHeader("x-appwrite-project", "{{apiKey}}")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/account/jwt")
.header("x-appwrite-project", "{{apiKey}}")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/account/jwt');
xhr.setRequestHeader('x-appwrite-project', '{{apiKey}}');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/account/jwt',
headers: {'x-appwrite-project': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/account/jwt';
const options = {method: 'POST', headers: {'x-appwrite-project': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/account/jwt',
method: 'POST',
headers: {
'x-appwrite-project': '{{apiKey}}'
}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/account/jwt")
.post(null)
.addHeader("x-appwrite-project", "{{apiKey}}")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/account/jwt',
headers: {
'x-appwrite-project': '{{apiKey}}'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/account/jwt',
headers: {'x-appwrite-project': '{{apiKey}}'}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/account/jwt');
req.headers({
'x-appwrite-project': '{{apiKey}}'
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/account/jwt',
headers: {'x-appwrite-project': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/account/jwt';
const options = {method: 'POST', headers: {'x-appwrite-project': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-appwrite-project": @"{{apiKey}}" };
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/account/jwt"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/account/jwt" in
let headers = Header.add (Header.init ()) "x-appwrite-project" "{{apiKey}}" in
Client.call ~headers `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/account/jwt",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"x-appwrite-project: {{apiKey}}"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/account/jwt', [
'headers' => [
'x-appwrite-project' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/account/jwt');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'x-appwrite-project' => '{{apiKey}}'
]);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/account/jwt');
$request->setRequestMethod('POST');
$request->setHeaders([
'x-appwrite-project' => '{{apiKey}}'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-appwrite-project", "{{apiKey}}")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/account/jwt' -Method POST -Headers $headers
$headers=@{}
$headers.Add("x-appwrite-project", "{{apiKey}}")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/account/jwt' -Method POST -Headers $headers
import http.client
conn = http.client.HTTPSConnection("example.com")
headers = { 'x-appwrite-project': "{{apiKey}}" }
conn.request("POST", "/baseUrl/account/jwt", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/account/jwt"
headers = {"x-appwrite-project": "{{apiKey}}"}
response = requests.post(url, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/account/jwt"
response <- VERB("POST", url, add_headers('x-appwrite-project' = '{{apiKey}}'), content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/account/jwt")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-appwrite-project"] = '{{apiKey}}'
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.post('/baseUrl/account/jwt') do |req|
req.headers['x-appwrite-project'] = '{{apiKey}}'
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/account/jwt";
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-appwrite-project", "{{apiKey}}".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/account/jwt \
--header 'x-appwrite-project: {{apiKey}}'
http POST {{baseUrl}}/account/jwt \
x-appwrite-project:'{{apiKey}}'
wget --quiet \
--method POST \
--header 'x-appwrite-project: {{apiKey}}' \
--output-document \
- {{baseUrl}}/account/jwt
import Foundation
let headers = ["x-appwrite-project": "{{apiKey}}"]
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/account/jwt")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
Create Account Session with OAuth2
{{baseUrl}}/account/sessions/oauth2/:provider
HEADERS
X-Appwrite-Project
{{apiKey}}
QUERY PARAMS
provider
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/account/sessions/oauth2/:provider");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-appwrite-project: {{apiKey}}");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/account/sessions/oauth2/:provider" {:headers {:x-appwrite-project "{{apiKey}}"}})
require "http/client"
url = "{{baseUrl}}/account/sessions/oauth2/:provider"
headers = HTTP::Headers{
"x-appwrite-project" => "{{apiKey}}"
}
response = HTTP::Client.get url, headers: headers
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/account/sessions/oauth2/:provider"),
Headers =
{
{ "x-appwrite-project", "{{apiKey}}" },
},
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/account/sessions/oauth2/:provider");
var request = new RestRequest("", Method.Get);
request.AddHeader("x-appwrite-project", "{{apiKey}}");
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/account/sessions/oauth2/:provider"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-appwrite-project", "{{apiKey}}")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/account/sessions/oauth2/:provider HTTP/1.1
X-Appwrite-Project: {{apiKey}}
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/account/sessions/oauth2/:provider")
.setHeader("x-appwrite-project", "{{apiKey}}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/account/sessions/oauth2/:provider"))
.header("x-appwrite-project", "{{apiKey}}")
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/account/sessions/oauth2/:provider")
.get()
.addHeader("x-appwrite-project", "{{apiKey}}")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/account/sessions/oauth2/:provider")
.header("x-appwrite-project", "{{apiKey}}")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/account/sessions/oauth2/:provider');
xhr.setRequestHeader('x-appwrite-project', '{{apiKey}}');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/account/sessions/oauth2/:provider',
headers: {'x-appwrite-project': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/account/sessions/oauth2/:provider';
const options = {method: 'GET', headers: {'x-appwrite-project': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/account/sessions/oauth2/:provider',
method: 'GET',
headers: {
'x-appwrite-project': '{{apiKey}}'
}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/account/sessions/oauth2/:provider")
.get()
.addHeader("x-appwrite-project", "{{apiKey}}")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/account/sessions/oauth2/:provider',
headers: {
'x-appwrite-project': '{{apiKey}}'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/account/sessions/oauth2/:provider',
headers: {'x-appwrite-project': '{{apiKey}}'}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/account/sessions/oauth2/:provider');
req.headers({
'x-appwrite-project': '{{apiKey}}'
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/account/sessions/oauth2/:provider',
headers: {'x-appwrite-project': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/account/sessions/oauth2/:provider';
const options = {method: 'GET', headers: {'x-appwrite-project': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-appwrite-project": @"{{apiKey}}" };
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/account/sessions/oauth2/:provider"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
[request setAllHTTPHeaderFields:headers];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/account/sessions/oauth2/:provider" in
let headers = Header.add (Header.init ()) "x-appwrite-project" "{{apiKey}}" in
Client.call ~headers `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/account/sessions/oauth2/:provider",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-appwrite-project: {{apiKey}}"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/account/sessions/oauth2/:provider', [
'headers' => [
'x-appwrite-project' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/account/sessions/oauth2/:provider');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders([
'x-appwrite-project' => '{{apiKey}}'
]);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/account/sessions/oauth2/:provider');
$request->setRequestMethod('GET');
$request->setHeaders([
'x-appwrite-project' => '{{apiKey}}'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-appwrite-project", "{{apiKey}}")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/account/sessions/oauth2/:provider' -Method GET -Headers $headers
$headers=@{}
$headers.Add("x-appwrite-project", "{{apiKey}}")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/account/sessions/oauth2/:provider' -Method GET -Headers $headers
import http.client
conn = http.client.HTTPSConnection("example.com")
headers = { 'x-appwrite-project': "{{apiKey}}" }
conn.request("GET", "/baseUrl/account/sessions/oauth2/:provider", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/account/sessions/oauth2/:provider"
headers = {"x-appwrite-project": "{{apiKey}}"}
response = requests.get(url, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/account/sessions/oauth2/:provider"
response <- VERB("GET", url, add_headers('x-appwrite-project' = '{{apiKey}}'), content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/account/sessions/oauth2/:provider")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-appwrite-project"] = '{{apiKey}}'
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/account/sessions/oauth2/:provider') do |req|
req.headers['x-appwrite-project'] = '{{apiKey}}'
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/account/sessions/oauth2/:provider";
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-appwrite-project", "{{apiKey}}".parse().unwrap());
let client = reqwest::Client::new();
let response = client.get(url)
.headers(headers)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/account/sessions/oauth2/:provider \
--header 'x-appwrite-project: {{apiKey}}'
http GET {{baseUrl}}/account/sessions/oauth2/:provider \
x-appwrite-project:'{{apiKey}}'
wget --quiet \
--method GET \
--header 'x-appwrite-project: {{apiKey}}' \
--output-document \
- {{baseUrl}}/account/sessions/oauth2/:provider
import Foundation
let headers = ["x-appwrite-project": "{{apiKey}}"]
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/account/sessions/oauth2/:provider")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
Create Account Session
{{baseUrl}}/account/sessions
HEADERS
X-Appwrite-Project
{{apiKey}}
BODY json
{
"email": "",
"password": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/account/sessions");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-appwrite-project: {{apiKey}}");
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"email\": \"\",\n \"password\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/account/sessions" {:headers {:x-appwrite-project "{{apiKey}}"}
:content-type :json
:form-params {:email ""
:password ""}})
require "http/client"
url = "{{baseUrl}}/account/sessions"
headers = HTTP::Headers{
"x-appwrite-project" => "{{apiKey}}"
"content-type" => "application/json"
}
reqBody = "{\n \"email\": \"\",\n \"password\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/account/sessions"),
Headers =
{
{ "x-appwrite-project", "{{apiKey}}" },
},
Content = new StringContent("{\n \"email\": \"\",\n \"password\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/account/sessions");
var request = new RestRequest("", Method.Post);
request.AddHeader("x-appwrite-project", "{{apiKey}}");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"email\": \"\",\n \"password\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/account/sessions"
payload := strings.NewReader("{\n \"email\": \"\",\n \"password\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-appwrite-project", "{{apiKey}}")
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/account/sessions HTTP/1.1
X-Appwrite-Project: {{apiKey}}
Content-Type: application/json
Host: example.com
Content-Length: 35
{
"email": "",
"password": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/account/sessions")
.setHeader("x-appwrite-project", "{{apiKey}}")
.setHeader("content-type", "application/json")
.setBody("{\n \"email\": \"\",\n \"password\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/account/sessions"))
.header("x-appwrite-project", "{{apiKey}}")
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"email\": \"\",\n \"password\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"email\": \"\",\n \"password\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/account/sessions")
.post(body)
.addHeader("x-appwrite-project", "{{apiKey}}")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/account/sessions")
.header("x-appwrite-project", "{{apiKey}}")
.header("content-type", "application/json")
.body("{\n \"email\": \"\",\n \"password\": \"\"\n}")
.asString();
const data = JSON.stringify({
email: '',
password: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/account/sessions');
xhr.setRequestHeader('x-appwrite-project', '{{apiKey}}');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/account/sessions',
headers: {'x-appwrite-project': '{{apiKey}}', 'content-type': 'application/json'},
data: {email: '', password: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/account/sessions';
const options = {
method: 'POST',
headers: {'x-appwrite-project': '{{apiKey}}', 'content-type': 'application/json'},
body: '{"email":"","password":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/account/sessions',
method: 'POST',
headers: {
'x-appwrite-project': '{{apiKey}}',
'content-type': 'application/json'
},
processData: false,
data: '{\n "email": "",\n "password": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"email\": \"\",\n \"password\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/account/sessions")
.post(body)
.addHeader("x-appwrite-project", "{{apiKey}}")
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/account/sessions',
headers: {
'x-appwrite-project': '{{apiKey}}',
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({email: '', password: ''}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/account/sessions',
headers: {'x-appwrite-project': '{{apiKey}}', 'content-type': 'application/json'},
body: {email: '', password: ''},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/account/sessions');
req.headers({
'x-appwrite-project': '{{apiKey}}',
'content-type': 'application/json'
});
req.type('json');
req.send({
email: '',
password: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/account/sessions',
headers: {'x-appwrite-project': '{{apiKey}}', 'content-type': 'application/json'},
data: {email: '', password: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/account/sessions';
const options = {
method: 'POST',
headers: {'x-appwrite-project': '{{apiKey}}', 'content-type': 'application/json'},
body: '{"email":"","password":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-appwrite-project": @"{{apiKey}}",
@"content-type": @"application/json" };
NSDictionary *parameters = @{ @"email": @"",
@"password": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/account/sessions"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/account/sessions" in
let headers = Header.add_list (Header.init ()) [
("x-appwrite-project", "{{apiKey}}");
("content-type", "application/json");
] in
let body = Cohttp_lwt_body.of_string "{\n \"email\": \"\",\n \"password\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/account/sessions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'email' => '',
'password' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json",
"x-appwrite-project: {{apiKey}}"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/account/sessions', [
'body' => '{
"email": "",
"password": ""
}',
'headers' => [
'content-type' => 'application/json',
'x-appwrite-project' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/account/sessions');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'x-appwrite-project' => '{{apiKey}}',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'email' => '',
'password' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'email' => '',
'password' => ''
]));
$request->setRequestUrl('{{baseUrl}}/account/sessions');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'x-appwrite-project' => '{{apiKey}}',
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-appwrite-project", "{{apiKey}}")
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/account/sessions' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"email": "",
"password": ""
}'
$headers=@{}
$headers.Add("x-appwrite-project", "{{apiKey}}")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/account/sessions' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"email": "",
"password": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"email\": \"\",\n \"password\": \"\"\n}"
headers = {
'x-appwrite-project': "{{apiKey}}",
'content-type': "application/json"
}
conn.request("POST", "/baseUrl/account/sessions", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/account/sessions"
payload = {
"email": "",
"password": ""
}
headers = {
"x-appwrite-project": "{{apiKey}}",
"content-type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/account/sessions"
payload <- "{\n \"email\": \"\",\n \"password\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, add_headers('x-appwrite-project' = '{{apiKey}}'), content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/account/sessions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-appwrite-project"] = '{{apiKey}}'
request["content-type"] = 'application/json'
request.body = "{\n \"email\": \"\",\n \"password\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/account/sessions') do |req|
req.headers['x-appwrite-project'] = '{{apiKey}}'
req.body = "{\n \"email\": \"\",\n \"password\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/account/sessions";
let payload = json!({
"email": "",
"password": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-appwrite-project", "{{apiKey}}".parse().unwrap());
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/account/sessions \
--header 'content-type: application/json' \
--header 'x-appwrite-project: {{apiKey}}' \
--data '{
"email": "",
"password": ""
}'
echo '{
"email": "",
"password": ""
}' | \
http POST {{baseUrl}}/account/sessions \
content-type:application/json \
x-appwrite-project:'{{apiKey}}'
wget --quiet \
--method POST \
--header 'x-appwrite-project: {{apiKey}}' \
--header 'content-type: application/json' \
--body-data '{\n "email": "",\n "password": ""\n}' \
--output-document \
- {{baseUrl}}/account/sessions
import Foundation
let headers = [
"x-appwrite-project": "{{apiKey}}",
"content-type": "application/json"
]
let parameters = [
"email": "",
"password": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/account/sessions")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
Create Account
{{baseUrl}}/account
HEADERS
X-Appwrite-Project
{{apiKey}}
BODY json
{
"email": "",
"name": "",
"password": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/account");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-appwrite-project: {{apiKey}}");
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"email\": \"\",\n \"name\": \"\",\n \"password\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/account" {:headers {:x-appwrite-project "{{apiKey}}"}
:content-type :json
:form-params {:email ""
:name ""
:password ""}})
require "http/client"
url = "{{baseUrl}}/account"
headers = HTTP::Headers{
"x-appwrite-project" => "{{apiKey}}"
"content-type" => "application/json"
}
reqBody = "{\n \"email\": \"\",\n \"name\": \"\",\n \"password\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/account"),
Headers =
{
{ "x-appwrite-project", "{{apiKey}}" },
},
Content = new StringContent("{\n \"email\": \"\",\n \"name\": \"\",\n \"password\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/account");
var request = new RestRequest("", Method.Post);
request.AddHeader("x-appwrite-project", "{{apiKey}}");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"email\": \"\",\n \"name\": \"\",\n \"password\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/account"
payload := strings.NewReader("{\n \"email\": \"\",\n \"name\": \"\",\n \"password\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-appwrite-project", "{{apiKey}}")
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/account HTTP/1.1
X-Appwrite-Project: {{apiKey}}
Content-Type: application/json
Host: example.com
Content-Length: 49
{
"email": "",
"name": "",
"password": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/account")
.setHeader("x-appwrite-project", "{{apiKey}}")
.setHeader("content-type", "application/json")
.setBody("{\n \"email\": \"\",\n \"name\": \"\",\n \"password\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/account"))
.header("x-appwrite-project", "{{apiKey}}")
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"email\": \"\",\n \"name\": \"\",\n \"password\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"email\": \"\",\n \"name\": \"\",\n \"password\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/account")
.post(body)
.addHeader("x-appwrite-project", "{{apiKey}}")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/account")
.header("x-appwrite-project", "{{apiKey}}")
.header("content-type", "application/json")
.body("{\n \"email\": \"\",\n \"name\": \"\",\n \"password\": \"\"\n}")
.asString();
const data = JSON.stringify({
email: '',
name: '',
password: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/account');
xhr.setRequestHeader('x-appwrite-project', '{{apiKey}}');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/account',
headers: {'x-appwrite-project': '{{apiKey}}', 'content-type': 'application/json'},
data: {email: '', name: '', password: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/account';
const options = {
method: 'POST',
headers: {'x-appwrite-project': '{{apiKey}}', 'content-type': 'application/json'},
body: '{"email":"","name":"","password":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/account',
method: 'POST',
headers: {
'x-appwrite-project': '{{apiKey}}',
'content-type': 'application/json'
},
processData: false,
data: '{\n "email": "",\n "name": "",\n "password": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"email\": \"\",\n \"name\": \"\",\n \"password\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/account")
.post(body)
.addHeader("x-appwrite-project", "{{apiKey}}")
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/account',
headers: {
'x-appwrite-project': '{{apiKey}}',
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({email: '', name: '', password: ''}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/account',
headers: {'x-appwrite-project': '{{apiKey}}', 'content-type': 'application/json'},
body: {email: '', name: '', password: ''},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/account');
req.headers({
'x-appwrite-project': '{{apiKey}}',
'content-type': 'application/json'
});
req.type('json');
req.send({
email: '',
name: '',
password: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/account',
headers: {'x-appwrite-project': '{{apiKey}}', 'content-type': 'application/json'},
data: {email: '', name: '', password: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/account';
const options = {
method: 'POST',
headers: {'x-appwrite-project': '{{apiKey}}', 'content-type': 'application/json'},
body: '{"email":"","name":"","password":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-appwrite-project": @"{{apiKey}}",
@"content-type": @"application/json" };
NSDictionary *parameters = @{ @"email": @"",
@"name": @"",
@"password": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/account"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/account" in
let headers = Header.add_list (Header.init ()) [
("x-appwrite-project", "{{apiKey}}");
("content-type", "application/json");
] in
let body = Cohttp_lwt_body.of_string "{\n \"email\": \"\",\n \"name\": \"\",\n \"password\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/account",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'email' => '',
'name' => '',
'password' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json",
"x-appwrite-project: {{apiKey}}"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/account', [
'body' => '{
"email": "",
"name": "",
"password": ""
}',
'headers' => [
'content-type' => 'application/json',
'x-appwrite-project' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/account');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'x-appwrite-project' => '{{apiKey}}',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'email' => '',
'name' => '',
'password' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'email' => '',
'name' => '',
'password' => ''
]));
$request->setRequestUrl('{{baseUrl}}/account');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'x-appwrite-project' => '{{apiKey}}',
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-appwrite-project", "{{apiKey}}")
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/account' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"email": "",
"name": "",
"password": ""
}'
$headers=@{}
$headers.Add("x-appwrite-project", "{{apiKey}}")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/account' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"email": "",
"name": "",
"password": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"email\": \"\",\n \"name\": \"\",\n \"password\": \"\"\n}"
headers = {
'x-appwrite-project': "{{apiKey}}",
'content-type': "application/json"
}
conn.request("POST", "/baseUrl/account", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/account"
payload = {
"email": "",
"name": "",
"password": ""
}
headers = {
"x-appwrite-project": "{{apiKey}}",
"content-type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/account"
payload <- "{\n \"email\": \"\",\n \"name\": \"\",\n \"password\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, add_headers('x-appwrite-project' = '{{apiKey}}'), content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/account")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-appwrite-project"] = '{{apiKey}}'
request["content-type"] = 'application/json'
request.body = "{\n \"email\": \"\",\n \"name\": \"\",\n \"password\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/account') do |req|
req.headers['x-appwrite-project'] = '{{apiKey}}'
req.body = "{\n \"email\": \"\",\n \"name\": \"\",\n \"password\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/account";
let payload = json!({
"email": "",
"name": "",
"password": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-appwrite-project", "{{apiKey}}".parse().unwrap());
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/account \
--header 'content-type: application/json' \
--header 'x-appwrite-project: {{apiKey}}' \
--data '{
"email": "",
"name": "",
"password": ""
}'
echo '{
"email": "",
"name": "",
"password": ""
}' | \
http POST {{baseUrl}}/account \
content-type:application/json \
x-appwrite-project:'{{apiKey}}'
wget --quiet \
--method POST \
--header 'x-appwrite-project: {{apiKey}}' \
--header 'content-type: application/json' \
--body-data '{\n "email": "",\n "name": "",\n "password": ""\n}' \
--output-document \
- {{baseUrl}}/account
import Foundation
let headers = [
"x-appwrite-project": "{{apiKey}}",
"content-type": "application/json"
]
let parameters = [
"email": "",
"name": "",
"password": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/account")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
Create Anonymous Session
{{baseUrl}}/account/sessions/anonymous
HEADERS
X-Appwrite-Project
{{apiKey}}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/account/sessions/anonymous");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-appwrite-project: {{apiKey}}");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/account/sessions/anonymous" {:headers {:x-appwrite-project "{{apiKey}}"}})
require "http/client"
url = "{{baseUrl}}/account/sessions/anonymous"
headers = HTTP::Headers{
"x-appwrite-project" => "{{apiKey}}"
}
response = HTTP::Client.post url, headers: headers
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/account/sessions/anonymous"),
Headers =
{
{ "x-appwrite-project", "{{apiKey}}" },
},
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/account/sessions/anonymous");
var request = new RestRequest("", Method.Post);
request.AddHeader("x-appwrite-project", "{{apiKey}}");
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/account/sessions/anonymous"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("x-appwrite-project", "{{apiKey}}")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/account/sessions/anonymous HTTP/1.1
X-Appwrite-Project: {{apiKey}}
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/account/sessions/anonymous")
.setHeader("x-appwrite-project", "{{apiKey}}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/account/sessions/anonymous"))
.header("x-appwrite-project", "{{apiKey}}")
.method("POST", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/account/sessions/anonymous")
.post(null)
.addHeader("x-appwrite-project", "{{apiKey}}")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/account/sessions/anonymous")
.header("x-appwrite-project", "{{apiKey}}")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/account/sessions/anonymous');
xhr.setRequestHeader('x-appwrite-project', '{{apiKey}}');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/account/sessions/anonymous',
headers: {'x-appwrite-project': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/account/sessions/anonymous';
const options = {method: 'POST', headers: {'x-appwrite-project': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/account/sessions/anonymous',
method: 'POST',
headers: {
'x-appwrite-project': '{{apiKey}}'
}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/account/sessions/anonymous")
.post(null)
.addHeader("x-appwrite-project", "{{apiKey}}")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/account/sessions/anonymous',
headers: {
'x-appwrite-project': '{{apiKey}}'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/account/sessions/anonymous',
headers: {'x-appwrite-project': '{{apiKey}}'}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/account/sessions/anonymous');
req.headers({
'x-appwrite-project': '{{apiKey}}'
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/account/sessions/anonymous',
headers: {'x-appwrite-project': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/account/sessions/anonymous';
const options = {method: 'POST', headers: {'x-appwrite-project': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-appwrite-project": @"{{apiKey}}" };
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/account/sessions/anonymous"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/account/sessions/anonymous" in
let headers = Header.add (Header.init ()) "x-appwrite-project" "{{apiKey}}" in
Client.call ~headers `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/account/sessions/anonymous",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"x-appwrite-project: {{apiKey}}"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/account/sessions/anonymous', [
'headers' => [
'x-appwrite-project' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/account/sessions/anonymous');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'x-appwrite-project' => '{{apiKey}}'
]);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/account/sessions/anonymous');
$request->setRequestMethod('POST');
$request->setHeaders([
'x-appwrite-project' => '{{apiKey}}'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-appwrite-project", "{{apiKey}}")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/account/sessions/anonymous' -Method POST -Headers $headers
$headers=@{}
$headers.Add("x-appwrite-project", "{{apiKey}}")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/account/sessions/anonymous' -Method POST -Headers $headers
import http.client
conn = http.client.HTTPSConnection("example.com")
headers = { 'x-appwrite-project': "{{apiKey}}" }
conn.request("POST", "/baseUrl/account/sessions/anonymous", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/account/sessions/anonymous"
headers = {"x-appwrite-project": "{{apiKey}}"}
response = requests.post(url, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/account/sessions/anonymous"
response <- VERB("POST", url, add_headers('x-appwrite-project' = '{{apiKey}}'), content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/account/sessions/anonymous")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-appwrite-project"] = '{{apiKey}}'
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.post('/baseUrl/account/sessions/anonymous') do |req|
req.headers['x-appwrite-project'] = '{{apiKey}}'
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/account/sessions/anonymous";
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-appwrite-project", "{{apiKey}}".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/account/sessions/anonymous \
--header 'x-appwrite-project: {{apiKey}}'
http POST {{baseUrl}}/account/sessions/anonymous \
x-appwrite-project:'{{apiKey}}'
wget --quiet \
--method POST \
--header 'x-appwrite-project: {{apiKey}}' \
--output-document \
- {{baseUrl}}/account/sessions/anonymous
import Foundation
let headers = ["x-appwrite-project": "{{apiKey}}"]
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/account/sessions/anonymous")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
Create Email Verification
{{baseUrl}}/account/verification
HEADERS
X-Appwrite-JWT
{{apiKey}}
BODY json
{
"url": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/account/verification");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-appwrite-jwt: {{apiKey}}");
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"url\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/account/verification" {:headers {:x-appwrite-jwt "{{apiKey}}"}
:content-type :json
:form-params {:url ""}})
require "http/client"
url = "{{baseUrl}}/account/verification"
headers = HTTP::Headers{
"x-appwrite-jwt" => "{{apiKey}}"
"content-type" => "application/json"
}
reqBody = "{\n \"url\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/account/verification"),
Headers =
{
{ "x-appwrite-jwt", "{{apiKey}}" },
},
Content = new StringContent("{\n \"url\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/account/verification");
var request = new RestRequest("", Method.Post);
request.AddHeader("x-appwrite-jwt", "{{apiKey}}");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"url\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/account/verification"
payload := strings.NewReader("{\n \"url\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-appwrite-jwt", "{{apiKey}}")
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/account/verification HTTP/1.1
X-Appwrite-Jwt: {{apiKey}}
Content-Type: application/json
Host: example.com
Content-Length: 15
{
"url": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/account/verification")
.setHeader("x-appwrite-jwt", "{{apiKey}}")
.setHeader("content-type", "application/json")
.setBody("{\n \"url\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/account/verification"))
.header("x-appwrite-jwt", "{{apiKey}}")
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"url\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"url\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/account/verification")
.post(body)
.addHeader("x-appwrite-jwt", "{{apiKey}}")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/account/verification")
.header("x-appwrite-jwt", "{{apiKey}}")
.header("content-type", "application/json")
.body("{\n \"url\": \"\"\n}")
.asString();
const data = JSON.stringify({
url: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/account/verification');
xhr.setRequestHeader('x-appwrite-jwt', '{{apiKey}}');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/account/verification',
headers: {'x-appwrite-jwt': '{{apiKey}}', 'content-type': 'application/json'},
data: {url: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/account/verification';
const options = {
method: 'POST',
headers: {'x-appwrite-jwt': '{{apiKey}}', 'content-type': 'application/json'},
body: '{"url":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/account/verification',
method: 'POST',
headers: {
'x-appwrite-jwt': '{{apiKey}}',
'content-type': 'application/json'
},
processData: false,
data: '{\n "url": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"url\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/account/verification")
.post(body)
.addHeader("x-appwrite-jwt", "{{apiKey}}")
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/account/verification',
headers: {
'x-appwrite-jwt': '{{apiKey}}',
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({url: ''}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/account/verification',
headers: {'x-appwrite-jwt': '{{apiKey}}', 'content-type': 'application/json'},
body: {url: ''},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/account/verification');
req.headers({
'x-appwrite-jwt': '{{apiKey}}',
'content-type': 'application/json'
});
req.type('json');
req.send({
url: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/account/verification',
headers: {'x-appwrite-jwt': '{{apiKey}}', 'content-type': 'application/json'},
data: {url: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/account/verification';
const options = {
method: 'POST',
headers: {'x-appwrite-jwt': '{{apiKey}}', 'content-type': 'application/json'},
body: '{"url":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-appwrite-jwt": @"{{apiKey}}",
@"content-type": @"application/json" };
NSDictionary *parameters = @{ @"url": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/account/verification"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/account/verification" in
let headers = Header.add_list (Header.init ()) [
("x-appwrite-jwt", "{{apiKey}}");
("content-type", "application/json");
] in
let body = Cohttp_lwt_body.of_string "{\n \"url\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/account/verification",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'url' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json",
"x-appwrite-jwt: {{apiKey}}"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/account/verification', [
'body' => '{
"url": ""
}',
'headers' => [
'content-type' => 'application/json',
'x-appwrite-jwt' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/account/verification');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'x-appwrite-jwt' => '{{apiKey}}',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'url' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'url' => ''
]));
$request->setRequestUrl('{{baseUrl}}/account/verification');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'x-appwrite-jwt' => '{{apiKey}}',
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-appwrite-jwt", "{{apiKey}}")
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/account/verification' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"url": ""
}'
$headers=@{}
$headers.Add("x-appwrite-jwt", "{{apiKey}}")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/account/verification' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"url": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"url\": \"\"\n}"
headers = {
'x-appwrite-jwt': "{{apiKey}}",
'content-type': "application/json"
}
conn.request("POST", "/baseUrl/account/verification", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/account/verification"
payload = { "url": "" }
headers = {
"x-appwrite-jwt": "{{apiKey}}",
"content-type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/account/verification"
payload <- "{\n \"url\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, add_headers('x-appwrite-jwt' = '{{apiKey}}'), content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/account/verification")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-appwrite-jwt"] = '{{apiKey}}'
request["content-type"] = 'application/json'
request.body = "{\n \"url\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/account/verification') do |req|
req.headers['x-appwrite-jwt'] = '{{apiKey}}'
req.body = "{\n \"url\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/account/verification";
let payload = json!({"url": ""});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-appwrite-jwt", "{{apiKey}}".parse().unwrap());
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/account/verification \
--header 'content-type: application/json' \
--header 'x-appwrite-jwt: {{apiKey}}' \
--data '{
"url": ""
}'
echo '{
"url": ""
}' | \
http POST {{baseUrl}}/account/verification \
content-type:application/json \
x-appwrite-jwt:'{{apiKey}}'
wget --quiet \
--method POST \
--header 'x-appwrite-jwt: {{apiKey}}' \
--header 'content-type: application/json' \
--body-data '{\n "url": ""\n}' \
--output-document \
- {{baseUrl}}/account/verification
import Foundation
let headers = [
"x-appwrite-jwt": "{{apiKey}}",
"content-type": "application/json"
]
let parameters = ["url": ""] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/account/verification")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
Create Password Recovery
{{baseUrl}}/account/recovery
HEADERS
X-Appwrite-JWT
{{apiKey}}
BODY json
{
"email": "",
"url": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/account/recovery");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-appwrite-jwt: {{apiKey}}");
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"email\": \"\",\n \"url\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/account/recovery" {:headers {:x-appwrite-jwt "{{apiKey}}"}
:content-type :json
:form-params {:email ""
:url ""}})
require "http/client"
url = "{{baseUrl}}/account/recovery"
headers = HTTP::Headers{
"x-appwrite-jwt" => "{{apiKey}}"
"content-type" => "application/json"
}
reqBody = "{\n \"email\": \"\",\n \"url\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/account/recovery"),
Headers =
{
{ "x-appwrite-jwt", "{{apiKey}}" },
},
Content = new StringContent("{\n \"email\": \"\",\n \"url\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/account/recovery");
var request = new RestRequest("", Method.Post);
request.AddHeader("x-appwrite-jwt", "{{apiKey}}");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"email\": \"\",\n \"url\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/account/recovery"
payload := strings.NewReader("{\n \"email\": \"\",\n \"url\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-appwrite-jwt", "{{apiKey}}")
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/account/recovery HTTP/1.1
X-Appwrite-Jwt: {{apiKey}}
Content-Type: application/json
Host: example.com
Content-Length: 30
{
"email": "",
"url": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/account/recovery")
.setHeader("x-appwrite-jwt", "{{apiKey}}")
.setHeader("content-type", "application/json")
.setBody("{\n \"email\": \"\",\n \"url\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/account/recovery"))
.header("x-appwrite-jwt", "{{apiKey}}")
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"email\": \"\",\n \"url\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"email\": \"\",\n \"url\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/account/recovery")
.post(body)
.addHeader("x-appwrite-jwt", "{{apiKey}}")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/account/recovery")
.header("x-appwrite-jwt", "{{apiKey}}")
.header("content-type", "application/json")
.body("{\n \"email\": \"\",\n \"url\": \"\"\n}")
.asString();
const data = JSON.stringify({
email: '',
url: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/account/recovery');
xhr.setRequestHeader('x-appwrite-jwt', '{{apiKey}}');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/account/recovery',
headers: {'x-appwrite-jwt': '{{apiKey}}', 'content-type': 'application/json'},
data: {email: '', url: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/account/recovery';
const options = {
method: 'POST',
headers: {'x-appwrite-jwt': '{{apiKey}}', 'content-type': 'application/json'},
body: '{"email":"","url":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/account/recovery',
method: 'POST',
headers: {
'x-appwrite-jwt': '{{apiKey}}',
'content-type': 'application/json'
},
processData: false,
data: '{\n "email": "",\n "url": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"email\": \"\",\n \"url\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/account/recovery")
.post(body)
.addHeader("x-appwrite-jwt", "{{apiKey}}")
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/account/recovery',
headers: {
'x-appwrite-jwt': '{{apiKey}}',
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({email: '', url: ''}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/account/recovery',
headers: {'x-appwrite-jwt': '{{apiKey}}', 'content-type': 'application/json'},
body: {email: '', url: ''},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/account/recovery');
req.headers({
'x-appwrite-jwt': '{{apiKey}}',
'content-type': 'application/json'
});
req.type('json');
req.send({
email: '',
url: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/account/recovery',
headers: {'x-appwrite-jwt': '{{apiKey}}', 'content-type': 'application/json'},
data: {email: '', url: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/account/recovery';
const options = {
method: 'POST',
headers: {'x-appwrite-jwt': '{{apiKey}}', 'content-type': 'application/json'},
body: '{"email":"","url":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-appwrite-jwt": @"{{apiKey}}",
@"content-type": @"application/json" };
NSDictionary *parameters = @{ @"email": @"",
@"url": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/account/recovery"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/account/recovery" in
let headers = Header.add_list (Header.init ()) [
("x-appwrite-jwt", "{{apiKey}}");
("content-type", "application/json");
] in
let body = Cohttp_lwt_body.of_string "{\n \"email\": \"\",\n \"url\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/account/recovery",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'email' => '',
'url' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json",
"x-appwrite-jwt: {{apiKey}}"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/account/recovery', [
'body' => '{
"email": "",
"url": ""
}',
'headers' => [
'content-type' => 'application/json',
'x-appwrite-jwt' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/account/recovery');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'x-appwrite-jwt' => '{{apiKey}}',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'email' => '',
'url' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'email' => '',
'url' => ''
]));
$request->setRequestUrl('{{baseUrl}}/account/recovery');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'x-appwrite-jwt' => '{{apiKey}}',
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-appwrite-jwt", "{{apiKey}}")
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/account/recovery' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"email": "",
"url": ""
}'
$headers=@{}
$headers.Add("x-appwrite-jwt", "{{apiKey}}")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/account/recovery' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"email": "",
"url": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"email\": \"\",\n \"url\": \"\"\n}"
headers = {
'x-appwrite-jwt': "{{apiKey}}",
'content-type': "application/json"
}
conn.request("POST", "/baseUrl/account/recovery", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/account/recovery"
payload = {
"email": "",
"url": ""
}
headers = {
"x-appwrite-jwt": "{{apiKey}}",
"content-type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/account/recovery"
payload <- "{\n \"email\": \"\",\n \"url\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, add_headers('x-appwrite-jwt' = '{{apiKey}}'), content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/account/recovery")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-appwrite-jwt"] = '{{apiKey}}'
request["content-type"] = 'application/json'
request.body = "{\n \"email\": \"\",\n \"url\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/account/recovery') do |req|
req.headers['x-appwrite-jwt'] = '{{apiKey}}'
req.body = "{\n \"email\": \"\",\n \"url\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/account/recovery";
let payload = json!({
"email": "",
"url": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-appwrite-jwt", "{{apiKey}}".parse().unwrap());
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/account/recovery \
--header 'content-type: application/json' \
--header 'x-appwrite-jwt: {{apiKey}}' \
--data '{
"email": "",
"url": ""
}'
echo '{
"email": "",
"url": ""
}' | \
http POST {{baseUrl}}/account/recovery \
content-type:application/json \
x-appwrite-jwt:'{{apiKey}}'
wget --quiet \
--method POST \
--header 'x-appwrite-jwt: {{apiKey}}' \
--header 'content-type: application/json' \
--body-data '{\n "email": "",\n "url": ""\n}' \
--output-document \
- {{baseUrl}}/account/recovery
import Foundation
let headers = [
"x-appwrite-jwt": "{{apiKey}}",
"content-type": "application/json"
]
let parameters = [
"email": "",
"url": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/account/recovery")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
DELETE
Delete Account Session
{{baseUrl}}/account/sessions/:sessionId
HEADERS
X-Appwrite-JWT
{{apiKey}}
QUERY PARAMS
sessionId
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/account/sessions/:sessionId");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-appwrite-jwt: {{apiKey}}");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/account/sessions/:sessionId" {:headers {:x-appwrite-jwt "{{apiKey}}"}})
require "http/client"
url = "{{baseUrl}}/account/sessions/:sessionId"
headers = HTTP::Headers{
"x-appwrite-jwt" => "{{apiKey}}"
}
response = HTTP::Client.delete url, headers: headers
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Delete,
RequestUri = new Uri("{{baseUrl}}/account/sessions/:sessionId"),
Headers =
{
{ "x-appwrite-jwt", "{{apiKey}}" },
},
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/account/sessions/:sessionId");
var request = new RestRequest("", Method.Delete);
request.AddHeader("x-appwrite-jwt", "{{apiKey}}");
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/account/sessions/:sessionId"
req, _ := http.NewRequest("DELETE", url, nil)
req.Header.Add("x-appwrite-jwt", "{{apiKey}}")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
DELETE /baseUrl/account/sessions/:sessionId HTTP/1.1
X-Appwrite-Jwt: {{apiKey}}
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/account/sessions/:sessionId")
.setHeader("x-appwrite-jwt", "{{apiKey}}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/account/sessions/:sessionId"))
.header("x-appwrite-jwt", "{{apiKey}}")
.method("DELETE", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/account/sessions/:sessionId")
.delete(null)
.addHeader("x-appwrite-jwt", "{{apiKey}}")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/account/sessions/:sessionId")
.header("x-appwrite-jwt", "{{apiKey}}")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('DELETE', '{{baseUrl}}/account/sessions/:sessionId');
xhr.setRequestHeader('x-appwrite-jwt', '{{apiKey}}');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'DELETE',
url: '{{baseUrl}}/account/sessions/:sessionId',
headers: {'x-appwrite-jwt': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/account/sessions/:sessionId';
const options = {method: 'DELETE', headers: {'x-appwrite-jwt': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/account/sessions/:sessionId',
method: 'DELETE',
headers: {
'x-appwrite-jwt': '{{apiKey}}'
}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/account/sessions/:sessionId")
.delete(null)
.addHeader("x-appwrite-jwt", "{{apiKey}}")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'DELETE',
hostname: 'example.com',
port: null,
path: '/baseUrl/account/sessions/:sessionId',
headers: {
'x-appwrite-jwt': '{{apiKey}}'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'DELETE',
url: '{{baseUrl}}/account/sessions/:sessionId',
headers: {'x-appwrite-jwt': '{{apiKey}}'}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('DELETE', '{{baseUrl}}/account/sessions/:sessionId');
req.headers({
'x-appwrite-jwt': '{{apiKey}}'
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'DELETE',
url: '{{baseUrl}}/account/sessions/:sessionId',
headers: {'x-appwrite-jwt': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/account/sessions/:sessionId';
const options = {method: 'DELETE', headers: {'x-appwrite-jwt': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-appwrite-jwt": @"{{apiKey}}" };
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/account/sessions/:sessionId"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"DELETE"];
[request setAllHTTPHeaderFields:headers];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/account/sessions/:sessionId" in
let headers = Header.add (Header.init ()) "x-appwrite-jwt" "{{apiKey}}" in
Client.call ~headers `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/account/sessions/:sessionId",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_HTTPHEADER => [
"x-appwrite-jwt: {{apiKey}}"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('DELETE', '{{baseUrl}}/account/sessions/:sessionId', [
'headers' => [
'x-appwrite-jwt' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/account/sessions/:sessionId');
$request->setMethod(HTTP_METH_DELETE);
$request->setHeaders([
'x-appwrite-jwt' => '{{apiKey}}'
]);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/account/sessions/:sessionId');
$request->setRequestMethod('DELETE');
$request->setHeaders([
'x-appwrite-jwt' => '{{apiKey}}'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-appwrite-jwt", "{{apiKey}}")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/account/sessions/:sessionId' -Method DELETE -Headers $headers
$headers=@{}
$headers.Add("x-appwrite-jwt", "{{apiKey}}")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/account/sessions/:sessionId' -Method DELETE -Headers $headers
import http.client
conn = http.client.HTTPSConnection("example.com")
headers = { 'x-appwrite-jwt': "{{apiKey}}" }
conn.request("DELETE", "/baseUrl/account/sessions/:sessionId", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/account/sessions/:sessionId"
headers = {"x-appwrite-jwt": "{{apiKey}}"}
response = requests.delete(url, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/account/sessions/:sessionId"
response <- VERB("DELETE", url, add_headers('x-appwrite-jwt' = '{{apiKey}}'), content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/account/sessions/:sessionId")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["x-appwrite-jwt"] = '{{apiKey}}'
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.delete('/baseUrl/account/sessions/:sessionId') do |req|
req.headers['x-appwrite-jwt'] = '{{apiKey}}'
end
puts response.status
puts response.body
use std::str::FromStr;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/account/sessions/:sessionId";
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-appwrite-jwt", "{{apiKey}}".parse().unwrap());
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("DELETE").unwrap(), url)
.headers(headers)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request DELETE \
--url {{baseUrl}}/account/sessions/:sessionId \
--header 'x-appwrite-jwt: {{apiKey}}'
http DELETE {{baseUrl}}/account/sessions/:sessionId \
x-appwrite-jwt:'{{apiKey}}'
wget --quiet \
--method DELETE \
--header 'x-appwrite-jwt: {{apiKey}}' \
--output-document \
- {{baseUrl}}/account/sessions/:sessionId
import Foundation
let headers = ["x-appwrite-jwt": "{{apiKey}}"]
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/account/sessions/:sessionId")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "DELETE"
request.allHTTPHeaderFields = headers
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
DELETE
Delete Account
{{baseUrl}}/account
HEADERS
X-Appwrite-JWT
{{apiKey}}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/account");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-appwrite-jwt: {{apiKey}}");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/account" {:headers {:x-appwrite-jwt "{{apiKey}}"}})
require "http/client"
url = "{{baseUrl}}/account"
headers = HTTP::Headers{
"x-appwrite-jwt" => "{{apiKey}}"
}
response = HTTP::Client.delete url, headers: headers
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Delete,
RequestUri = new Uri("{{baseUrl}}/account"),
Headers =
{
{ "x-appwrite-jwt", "{{apiKey}}" },
},
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/account");
var request = new RestRequest("", Method.Delete);
request.AddHeader("x-appwrite-jwt", "{{apiKey}}");
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/account"
req, _ := http.NewRequest("DELETE", url, nil)
req.Header.Add("x-appwrite-jwt", "{{apiKey}}")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
DELETE /baseUrl/account HTTP/1.1
X-Appwrite-Jwt: {{apiKey}}
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/account")
.setHeader("x-appwrite-jwt", "{{apiKey}}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/account"))
.header("x-appwrite-jwt", "{{apiKey}}")
.method("DELETE", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/account")
.delete(null)
.addHeader("x-appwrite-jwt", "{{apiKey}}")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/account")
.header("x-appwrite-jwt", "{{apiKey}}")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('DELETE', '{{baseUrl}}/account');
xhr.setRequestHeader('x-appwrite-jwt', '{{apiKey}}');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'DELETE',
url: '{{baseUrl}}/account',
headers: {'x-appwrite-jwt': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/account';
const options = {method: 'DELETE', headers: {'x-appwrite-jwt': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/account',
method: 'DELETE',
headers: {
'x-appwrite-jwt': '{{apiKey}}'
}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/account")
.delete(null)
.addHeader("x-appwrite-jwt", "{{apiKey}}")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'DELETE',
hostname: 'example.com',
port: null,
path: '/baseUrl/account',
headers: {
'x-appwrite-jwt': '{{apiKey}}'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'DELETE',
url: '{{baseUrl}}/account',
headers: {'x-appwrite-jwt': '{{apiKey}}'}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('DELETE', '{{baseUrl}}/account');
req.headers({
'x-appwrite-jwt': '{{apiKey}}'
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'DELETE',
url: '{{baseUrl}}/account',
headers: {'x-appwrite-jwt': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/account';
const options = {method: 'DELETE', headers: {'x-appwrite-jwt': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-appwrite-jwt": @"{{apiKey}}" };
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/account"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"DELETE"];
[request setAllHTTPHeaderFields:headers];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/account" in
let headers = Header.add (Header.init ()) "x-appwrite-jwt" "{{apiKey}}" in
Client.call ~headers `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/account",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_HTTPHEADER => [
"x-appwrite-jwt: {{apiKey}}"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('DELETE', '{{baseUrl}}/account', [
'headers' => [
'x-appwrite-jwt' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/account');
$request->setMethod(HTTP_METH_DELETE);
$request->setHeaders([
'x-appwrite-jwt' => '{{apiKey}}'
]);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/account');
$request->setRequestMethod('DELETE');
$request->setHeaders([
'x-appwrite-jwt' => '{{apiKey}}'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-appwrite-jwt", "{{apiKey}}")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/account' -Method DELETE -Headers $headers
$headers=@{}
$headers.Add("x-appwrite-jwt", "{{apiKey}}")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/account' -Method DELETE -Headers $headers
import http.client
conn = http.client.HTTPSConnection("example.com")
headers = { 'x-appwrite-jwt': "{{apiKey}}" }
conn.request("DELETE", "/baseUrl/account", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/account"
headers = {"x-appwrite-jwt": "{{apiKey}}"}
response = requests.delete(url, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/account"
response <- VERB("DELETE", url, add_headers('x-appwrite-jwt' = '{{apiKey}}'), content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/account")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["x-appwrite-jwt"] = '{{apiKey}}'
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.delete('/baseUrl/account') do |req|
req.headers['x-appwrite-jwt'] = '{{apiKey}}'
end
puts response.status
puts response.body
use std::str::FromStr;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/account";
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-appwrite-jwt", "{{apiKey}}".parse().unwrap());
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("DELETE").unwrap(), url)
.headers(headers)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request DELETE \
--url {{baseUrl}}/account \
--header 'x-appwrite-jwt: {{apiKey}}'
http DELETE {{baseUrl}}/account \
x-appwrite-jwt:'{{apiKey}}'
wget --quiet \
--method DELETE \
--header 'x-appwrite-jwt: {{apiKey}}' \
--output-document \
- {{baseUrl}}/account
import Foundation
let headers = ["x-appwrite-jwt": "{{apiKey}}"]
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/account")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "DELETE"
request.allHTTPHeaderFields = headers
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
DELETE
Delete All Account Sessions
{{baseUrl}}/account/sessions
HEADERS
X-Appwrite-JWT
{{apiKey}}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/account/sessions");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-appwrite-jwt: {{apiKey}}");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/account/sessions" {:headers {:x-appwrite-jwt "{{apiKey}}"}})
require "http/client"
url = "{{baseUrl}}/account/sessions"
headers = HTTP::Headers{
"x-appwrite-jwt" => "{{apiKey}}"
}
response = HTTP::Client.delete url, headers: headers
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Delete,
RequestUri = new Uri("{{baseUrl}}/account/sessions"),
Headers =
{
{ "x-appwrite-jwt", "{{apiKey}}" },
},
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/account/sessions");
var request = new RestRequest("", Method.Delete);
request.AddHeader("x-appwrite-jwt", "{{apiKey}}");
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/account/sessions"
req, _ := http.NewRequest("DELETE", url, nil)
req.Header.Add("x-appwrite-jwt", "{{apiKey}}")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
DELETE /baseUrl/account/sessions HTTP/1.1
X-Appwrite-Jwt: {{apiKey}}
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/account/sessions")
.setHeader("x-appwrite-jwt", "{{apiKey}}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/account/sessions"))
.header("x-appwrite-jwt", "{{apiKey}}")
.method("DELETE", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/account/sessions")
.delete(null)
.addHeader("x-appwrite-jwt", "{{apiKey}}")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/account/sessions")
.header("x-appwrite-jwt", "{{apiKey}}")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('DELETE', '{{baseUrl}}/account/sessions');
xhr.setRequestHeader('x-appwrite-jwt', '{{apiKey}}');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'DELETE',
url: '{{baseUrl}}/account/sessions',
headers: {'x-appwrite-jwt': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/account/sessions';
const options = {method: 'DELETE', headers: {'x-appwrite-jwt': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/account/sessions',
method: 'DELETE',
headers: {
'x-appwrite-jwt': '{{apiKey}}'
}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/account/sessions")
.delete(null)
.addHeader("x-appwrite-jwt", "{{apiKey}}")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'DELETE',
hostname: 'example.com',
port: null,
path: '/baseUrl/account/sessions',
headers: {
'x-appwrite-jwt': '{{apiKey}}'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'DELETE',
url: '{{baseUrl}}/account/sessions',
headers: {'x-appwrite-jwt': '{{apiKey}}'}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('DELETE', '{{baseUrl}}/account/sessions');
req.headers({
'x-appwrite-jwt': '{{apiKey}}'
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'DELETE',
url: '{{baseUrl}}/account/sessions',
headers: {'x-appwrite-jwt': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/account/sessions';
const options = {method: 'DELETE', headers: {'x-appwrite-jwt': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-appwrite-jwt": @"{{apiKey}}" };
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/account/sessions"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"DELETE"];
[request setAllHTTPHeaderFields:headers];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/account/sessions" in
let headers = Header.add (Header.init ()) "x-appwrite-jwt" "{{apiKey}}" in
Client.call ~headers `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/account/sessions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_HTTPHEADER => [
"x-appwrite-jwt: {{apiKey}}"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('DELETE', '{{baseUrl}}/account/sessions', [
'headers' => [
'x-appwrite-jwt' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/account/sessions');
$request->setMethod(HTTP_METH_DELETE);
$request->setHeaders([
'x-appwrite-jwt' => '{{apiKey}}'
]);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/account/sessions');
$request->setRequestMethod('DELETE');
$request->setHeaders([
'x-appwrite-jwt' => '{{apiKey}}'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-appwrite-jwt", "{{apiKey}}")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/account/sessions' -Method DELETE -Headers $headers
$headers=@{}
$headers.Add("x-appwrite-jwt", "{{apiKey}}")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/account/sessions' -Method DELETE -Headers $headers
import http.client
conn = http.client.HTTPSConnection("example.com")
headers = { 'x-appwrite-jwt': "{{apiKey}}" }
conn.request("DELETE", "/baseUrl/account/sessions", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/account/sessions"
headers = {"x-appwrite-jwt": "{{apiKey}}"}
response = requests.delete(url, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/account/sessions"
response <- VERB("DELETE", url, add_headers('x-appwrite-jwt' = '{{apiKey}}'), content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/account/sessions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["x-appwrite-jwt"] = '{{apiKey}}'
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.delete('/baseUrl/account/sessions') do |req|
req.headers['x-appwrite-jwt'] = '{{apiKey}}'
end
puts response.status
puts response.body
use std::str::FromStr;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/account/sessions";
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-appwrite-jwt", "{{apiKey}}".parse().unwrap());
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("DELETE").unwrap(), url)
.headers(headers)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request DELETE \
--url {{baseUrl}}/account/sessions \
--header 'x-appwrite-jwt: {{apiKey}}'
http DELETE {{baseUrl}}/account/sessions \
x-appwrite-jwt:'{{apiKey}}'
wget --quiet \
--method DELETE \
--header 'x-appwrite-jwt: {{apiKey}}' \
--output-document \
- {{baseUrl}}/account/sessions
import Foundation
let headers = ["x-appwrite-jwt": "{{apiKey}}"]
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/account/sessions")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "DELETE"
request.allHTTPHeaderFields = headers
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
Get Account Logs
{{baseUrl}}/account/logs
HEADERS
X-Appwrite-JWT
{{apiKey}}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/account/logs");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-appwrite-jwt: {{apiKey}}");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/account/logs" {:headers {:x-appwrite-jwt "{{apiKey}}"}})
require "http/client"
url = "{{baseUrl}}/account/logs"
headers = HTTP::Headers{
"x-appwrite-jwt" => "{{apiKey}}"
}
response = HTTP::Client.get url, headers: headers
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/account/logs"),
Headers =
{
{ "x-appwrite-jwt", "{{apiKey}}" },
},
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/account/logs");
var request = new RestRequest("", Method.Get);
request.AddHeader("x-appwrite-jwt", "{{apiKey}}");
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/account/logs"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-appwrite-jwt", "{{apiKey}}")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/account/logs HTTP/1.1
X-Appwrite-Jwt: {{apiKey}}
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/account/logs")
.setHeader("x-appwrite-jwt", "{{apiKey}}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/account/logs"))
.header("x-appwrite-jwt", "{{apiKey}}")
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/account/logs")
.get()
.addHeader("x-appwrite-jwt", "{{apiKey}}")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/account/logs")
.header("x-appwrite-jwt", "{{apiKey}}")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/account/logs');
xhr.setRequestHeader('x-appwrite-jwt', '{{apiKey}}');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/account/logs',
headers: {'x-appwrite-jwt': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/account/logs';
const options = {method: 'GET', headers: {'x-appwrite-jwt': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/account/logs',
method: 'GET',
headers: {
'x-appwrite-jwt': '{{apiKey}}'
}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/account/logs")
.get()
.addHeader("x-appwrite-jwt", "{{apiKey}}")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/account/logs',
headers: {
'x-appwrite-jwt': '{{apiKey}}'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/account/logs',
headers: {'x-appwrite-jwt': '{{apiKey}}'}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/account/logs');
req.headers({
'x-appwrite-jwt': '{{apiKey}}'
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/account/logs',
headers: {'x-appwrite-jwt': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/account/logs';
const options = {method: 'GET', headers: {'x-appwrite-jwt': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-appwrite-jwt": @"{{apiKey}}" };
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/account/logs"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
[request setAllHTTPHeaderFields:headers];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/account/logs" in
let headers = Header.add (Header.init ()) "x-appwrite-jwt" "{{apiKey}}" in
Client.call ~headers `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/account/logs",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-appwrite-jwt: {{apiKey}}"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/account/logs', [
'headers' => [
'x-appwrite-jwt' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/account/logs');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders([
'x-appwrite-jwt' => '{{apiKey}}'
]);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/account/logs');
$request->setRequestMethod('GET');
$request->setHeaders([
'x-appwrite-jwt' => '{{apiKey}}'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-appwrite-jwt", "{{apiKey}}")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/account/logs' -Method GET -Headers $headers
$headers=@{}
$headers.Add("x-appwrite-jwt", "{{apiKey}}")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/account/logs' -Method GET -Headers $headers
import http.client
conn = http.client.HTTPSConnection("example.com")
headers = { 'x-appwrite-jwt': "{{apiKey}}" }
conn.request("GET", "/baseUrl/account/logs", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/account/logs"
headers = {"x-appwrite-jwt": "{{apiKey}}"}
response = requests.get(url, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/account/logs"
response <- VERB("GET", url, add_headers('x-appwrite-jwt' = '{{apiKey}}'), content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/account/logs")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-appwrite-jwt"] = '{{apiKey}}'
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/account/logs') do |req|
req.headers['x-appwrite-jwt'] = '{{apiKey}}'
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/account/logs";
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-appwrite-jwt", "{{apiKey}}".parse().unwrap());
let client = reqwest::Client::new();
let response = client.get(url)
.headers(headers)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/account/logs \
--header 'x-appwrite-jwt: {{apiKey}}'
http GET {{baseUrl}}/account/logs \
x-appwrite-jwt:'{{apiKey}}'
wget --quiet \
--method GET \
--header 'x-appwrite-jwt: {{apiKey}}' \
--output-document \
- {{baseUrl}}/account/logs
import Foundation
let headers = ["x-appwrite-jwt": "{{apiKey}}"]
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/account/logs")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
Get Account Preferences
{{baseUrl}}/account/prefs
HEADERS
X-Appwrite-JWT
{{apiKey}}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/account/prefs");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-appwrite-jwt: {{apiKey}}");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/account/prefs" {:headers {:x-appwrite-jwt "{{apiKey}}"}})
require "http/client"
url = "{{baseUrl}}/account/prefs"
headers = HTTP::Headers{
"x-appwrite-jwt" => "{{apiKey}}"
}
response = HTTP::Client.get url, headers: headers
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/account/prefs"),
Headers =
{
{ "x-appwrite-jwt", "{{apiKey}}" },
},
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/account/prefs");
var request = new RestRequest("", Method.Get);
request.AddHeader("x-appwrite-jwt", "{{apiKey}}");
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/account/prefs"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-appwrite-jwt", "{{apiKey}}")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/account/prefs HTTP/1.1
X-Appwrite-Jwt: {{apiKey}}
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/account/prefs")
.setHeader("x-appwrite-jwt", "{{apiKey}}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/account/prefs"))
.header("x-appwrite-jwt", "{{apiKey}}")
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/account/prefs")
.get()
.addHeader("x-appwrite-jwt", "{{apiKey}}")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/account/prefs")
.header("x-appwrite-jwt", "{{apiKey}}")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/account/prefs');
xhr.setRequestHeader('x-appwrite-jwt', '{{apiKey}}');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/account/prefs',
headers: {'x-appwrite-jwt': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/account/prefs';
const options = {method: 'GET', headers: {'x-appwrite-jwt': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/account/prefs',
method: 'GET',
headers: {
'x-appwrite-jwt': '{{apiKey}}'
}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/account/prefs")
.get()
.addHeader("x-appwrite-jwt", "{{apiKey}}")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/account/prefs',
headers: {
'x-appwrite-jwt': '{{apiKey}}'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/account/prefs',
headers: {'x-appwrite-jwt': '{{apiKey}}'}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/account/prefs');
req.headers({
'x-appwrite-jwt': '{{apiKey}}'
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/account/prefs',
headers: {'x-appwrite-jwt': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/account/prefs';
const options = {method: 'GET', headers: {'x-appwrite-jwt': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-appwrite-jwt": @"{{apiKey}}" };
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/account/prefs"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
[request setAllHTTPHeaderFields:headers];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/account/prefs" in
let headers = Header.add (Header.init ()) "x-appwrite-jwt" "{{apiKey}}" in
Client.call ~headers `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/account/prefs",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-appwrite-jwt: {{apiKey}}"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/account/prefs', [
'headers' => [
'x-appwrite-jwt' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/account/prefs');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders([
'x-appwrite-jwt' => '{{apiKey}}'
]);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/account/prefs');
$request->setRequestMethod('GET');
$request->setHeaders([
'x-appwrite-jwt' => '{{apiKey}}'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-appwrite-jwt", "{{apiKey}}")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/account/prefs' -Method GET -Headers $headers
$headers=@{}
$headers.Add("x-appwrite-jwt", "{{apiKey}}")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/account/prefs' -Method GET -Headers $headers
import http.client
conn = http.client.HTTPSConnection("example.com")
headers = { 'x-appwrite-jwt': "{{apiKey}}" }
conn.request("GET", "/baseUrl/account/prefs", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/account/prefs"
headers = {"x-appwrite-jwt": "{{apiKey}}"}
response = requests.get(url, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/account/prefs"
response <- VERB("GET", url, add_headers('x-appwrite-jwt' = '{{apiKey}}'), content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/account/prefs")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-appwrite-jwt"] = '{{apiKey}}'
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/account/prefs') do |req|
req.headers['x-appwrite-jwt'] = '{{apiKey}}'
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/account/prefs";
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-appwrite-jwt", "{{apiKey}}".parse().unwrap());
let client = reqwest::Client::new();
let response = client.get(url)
.headers(headers)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/account/prefs \
--header 'x-appwrite-jwt: {{apiKey}}'
http GET {{baseUrl}}/account/prefs \
x-appwrite-jwt:'{{apiKey}}'
wget --quiet \
--method GET \
--header 'x-appwrite-jwt: {{apiKey}}' \
--output-document \
- {{baseUrl}}/account/prefs
import Foundation
let headers = ["x-appwrite-jwt": "{{apiKey}}"]
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/account/prefs")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
Get Account Sessions
{{baseUrl}}/account/sessions
HEADERS
X-Appwrite-JWT
{{apiKey}}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/account/sessions");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-appwrite-jwt: {{apiKey}}");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/account/sessions" {:headers {:x-appwrite-jwt "{{apiKey}}"}})
require "http/client"
url = "{{baseUrl}}/account/sessions"
headers = HTTP::Headers{
"x-appwrite-jwt" => "{{apiKey}}"
}
response = HTTP::Client.get url, headers: headers
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/account/sessions"),
Headers =
{
{ "x-appwrite-jwt", "{{apiKey}}" },
},
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/account/sessions");
var request = new RestRequest("", Method.Get);
request.AddHeader("x-appwrite-jwt", "{{apiKey}}");
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/account/sessions"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-appwrite-jwt", "{{apiKey}}")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/account/sessions HTTP/1.1
X-Appwrite-Jwt: {{apiKey}}
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/account/sessions")
.setHeader("x-appwrite-jwt", "{{apiKey}}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/account/sessions"))
.header("x-appwrite-jwt", "{{apiKey}}")
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/account/sessions")
.get()
.addHeader("x-appwrite-jwt", "{{apiKey}}")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/account/sessions")
.header("x-appwrite-jwt", "{{apiKey}}")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/account/sessions');
xhr.setRequestHeader('x-appwrite-jwt', '{{apiKey}}');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/account/sessions',
headers: {'x-appwrite-jwt': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/account/sessions';
const options = {method: 'GET', headers: {'x-appwrite-jwt': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/account/sessions',
method: 'GET',
headers: {
'x-appwrite-jwt': '{{apiKey}}'
}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/account/sessions")
.get()
.addHeader("x-appwrite-jwt", "{{apiKey}}")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/account/sessions',
headers: {
'x-appwrite-jwt': '{{apiKey}}'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/account/sessions',
headers: {'x-appwrite-jwt': '{{apiKey}}'}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/account/sessions');
req.headers({
'x-appwrite-jwt': '{{apiKey}}'
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/account/sessions',
headers: {'x-appwrite-jwt': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/account/sessions';
const options = {method: 'GET', headers: {'x-appwrite-jwt': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-appwrite-jwt": @"{{apiKey}}" };
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/account/sessions"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
[request setAllHTTPHeaderFields:headers];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/account/sessions" in
let headers = Header.add (Header.init ()) "x-appwrite-jwt" "{{apiKey}}" in
Client.call ~headers `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/account/sessions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-appwrite-jwt: {{apiKey}}"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/account/sessions', [
'headers' => [
'x-appwrite-jwt' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/account/sessions');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders([
'x-appwrite-jwt' => '{{apiKey}}'
]);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/account/sessions');
$request->setRequestMethod('GET');
$request->setHeaders([
'x-appwrite-jwt' => '{{apiKey}}'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-appwrite-jwt", "{{apiKey}}")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/account/sessions' -Method GET -Headers $headers
$headers=@{}
$headers.Add("x-appwrite-jwt", "{{apiKey}}")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/account/sessions' -Method GET -Headers $headers
import http.client
conn = http.client.HTTPSConnection("example.com")
headers = { 'x-appwrite-jwt': "{{apiKey}}" }
conn.request("GET", "/baseUrl/account/sessions", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/account/sessions"
headers = {"x-appwrite-jwt": "{{apiKey}}"}
response = requests.get(url, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/account/sessions"
response <- VERB("GET", url, add_headers('x-appwrite-jwt' = '{{apiKey}}'), content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/account/sessions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-appwrite-jwt"] = '{{apiKey}}'
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/account/sessions') do |req|
req.headers['x-appwrite-jwt'] = '{{apiKey}}'
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/account/sessions";
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-appwrite-jwt", "{{apiKey}}".parse().unwrap());
let client = reqwest::Client::new();
let response = client.get(url)
.headers(headers)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/account/sessions \
--header 'x-appwrite-jwt: {{apiKey}}'
http GET {{baseUrl}}/account/sessions \
x-appwrite-jwt:'{{apiKey}}'
wget --quiet \
--method GET \
--header 'x-appwrite-jwt: {{apiKey}}' \
--output-document \
- {{baseUrl}}/account/sessions
import Foundation
let headers = ["x-appwrite-jwt": "{{apiKey}}"]
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/account/sessions")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
Get Account
{{baseUrl}}/account
HEADERS
X-Appwrite-JWT
{{apiKey}}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/account");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-appwrite-jwt: {{apiKey}}");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/account" {:headers {:x-appwrite-jwt "{{apiKey}}"}})
require "http/client"
url = "{{baseUrl}}/account"
headers = HTTP::Headers{
"x-appwrite-jwt" => "{{apiKey}}"
}
response = HTTP::Client.get url, headers: headers
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/account"),
Headers =
{
{ "x-appwrite-jwt", "{{apiKey}}" },
},
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/account");
var request = new RestRequest("", Method.Get);
request.AddHeader("x-appwrite-jwt", "{{apiKey}}");
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/account"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-appwrite-jwt", "{{apiKey}}")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/account HTTP/1.1
X-Appwrite-Jwt: {{apiKey}}
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/account")
.setHeader("x-appwrite-jwt", "{{apiKey}}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/account"))
.header("x-appwrite-jwt", "{{apiKey}}")
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/account")
.get()
.addHeader("x-appwrite-jwt", "{{apiKey}}")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/account")
.header("x-appwrite-jwt", "{{apiKey}}")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/account');
xhr.setRequestHeader('x-appwrite-jwt', '{{apiKey}}');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/account',
headers: {'x-appwrite-jwt': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/account';
const options = {method: 'GET', headers: {'x-appwrite-jwt': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/account',
method: 'GET',
headers: {
'x-appwrite-jwt': '{{apiKey}}'
}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/account")
.get()
.addHeader("x-appwrite-jwt", "{{apiKey}}")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/account',
headers: {
'x-appwrite-jwt': '{{apiKey}}'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/account',
headers: {'x-appwrite-jwt': '{{apiKey}}'}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/account');
req.headers({
'x-appwrite-jwt': '{{apiKey}}'
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/account',
headers: {'x-appwrite-jwt': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/account';
const options = {method: 'GET', headers: {'x-appwrite-jwt': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-appwrite-jwt": @"{{apiKey}}" };
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/account"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
[request setAllHTTPHeaderFields:headers];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/account" in
let headers = Header.add (Header.init ()) "x-appwrite-jwt" "{{apiKey}}" in
Client.call ~headers `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/account",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-appwrite-jwt: {{apiKey}}"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/account', [
'headers' => [
'x-appwrite-jwt' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/account');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders([
'x-appwrite-jwt' => '{{apiKey}}'
]);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/account');
$request->setRequestMethod('GET');
$request->setHeaders([
'x-appwrite-jwt' => '{{apiKey}}'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-appwrite-jwt", "{{apiKey}}")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/account' -Method GET -Headers $headers
$headers=@{}
$headers.Add("x-appwrite-jwt", "{{apiKey}}")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/account' -Method GET -Headers $headers
import http.client
conn = http.client.HTTPSConnection("example.com")
headers = { 'x-appwrite-jwt': "{{apiKey}}" }
conn.request("GET", "/baseUrl/account", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/account"
headers = {"x-appwrite-jwt": "{{apiKey}}"}
response = requests.get(url, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/account"
response <- VERB("GET", url, add_headers('x-appwrite-jwt' = '{{apiKey}}'), content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/account")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-appwrite-jwt"] = '{{apiKey}}'
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/account') do |req|
req.headers['x-appwrite-jwt'] = '{{apiKey}}'
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/account";
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-appwrite-jwt", "{{apiKey}}".parse().unwrap());
let client = reqwest::Client::new();
let response = client.get(url)
.headers(headers)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/account \
--header 'x-appwrite-jwt: {{apiKey}}'
http GET {{baseUrl}}/account \
x-appwrite-jwt:'{{apiKey}}'
wget --quiet \
--method GET \
--header 'x-appwrite-jwt: {{apiKey}}' \
--output-document \
- {{baseUrl}}/account
import Foundation
let headers = ["x-appwrite-jwt": "{{apiKey}}"]
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/account")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
Get Session By ID
{{baseUrl}}/account/sessions/:sessionId
HEADERS
X-Appwrite-JWT
{{apiKey}}
QUERY PARAMS
sessionId
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/account/sessions/:sessionId");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-appwrite-jwt: {{apiKey}}");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/account/sessions/:sessionId" {:headers {:x-appwrite-jwt "{{apiKey}}"}})
require "http/client"
url = "{{baseUrl}}/account/sessions/:sessionId"
headers = HTTP::Headers{
"x-appwrite-jwt" => "{{apiKey}}"
}
response = HTTP::Client.get url, headers: headers
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/account/sessions/:sessionId"),
Headers =
{
{ "x-appwrite-jwt", "{{apiKey}}" },
},
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/account/sessions/:sessionId");
var request = new RestRequest("", Method.Get);
request.AddHeader("x-appwrite-jwt", "{{apiKey}}");
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/account/sessions/:sessionId"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-appwrite-jwt", "{{apiKey}}")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/account/sessions/:sessionId HTTP/1.1
X-Appwrite-Jwt: {{apiKey}}
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/account/sessions/:sessionId")
.setHeader("x-appwrite-jwt", "{{apiKey}}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/account/sessions/:sessionId"))
.header("x-appwrite-jwt", "{{apiKey}}")
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/account/sessions/:sessionId")
.get()
.addHeader("x-appwrite-jwt", "{{apiKey}}")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/account/sessions/:sessionId")
.header("x-appwrite-jwt", "{{apiKey}}")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/account/sessions/:sessionId');
xhr.setRequestHeader('x-appwrite-jwt', '{{apiKey}}');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/account/sessions/:sessionId',
headers: {'x-appwrite-jwt': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/account/sessions/:sessionId';
const options = {method: 'GET', headers: {'x-appwrite-jwt': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/account/sessions/:sessionId',
method: 'GET',
headers: {
'x-appwrite-jwt': '{{apiKey}}'
}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/account/sessions/:sessionId")
.get()
.addHeader("x-appwrite-jwt", "{{apiKey}}")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/account/sessions/:sessionId',
headers: {
'x-appwrite-jwt': '{{apiKey}}'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/account/sessions/:sessionId',
headers: {'x-appwrite-jwt': '{{apiKey}}'}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/account/sessions/:sessionId');
req.headers({
'x-appwrite-jwt': '{{apiKey}}'
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/account/sessions/:sessionId',
headers: {'x-appwrite-jwt': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/account/sessions/:sessionId';
const options = {method: 'GET', headers: {'x-appwrite-jwt': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-appwrite-jwt": @"{{apiKey}}" };
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/account/sessions/:sessionId"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
[request setAllHTTPHeaderFields:headers];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/account/sessions/:sessionId" in
let headers = Header.add (Header.init ()) "x-appwrite-jwt" "{{apiKey}}" in
Client.call ~headers `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/account/sessions/:sessionId",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-appwrite-jwt: {{apiKey}}"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/account/sessions/:sessionId', [
'headers' => [
'x-appwrite-jwt' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/account/sessions/:sessionId');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders([
'x-appwrite-jwt' => '{{apiKey}}'
]);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/account/sessions/:sessionId');
$request->setRequestMethod('GET');
$request->setHeaders([
'x-appwrite-jwt' => '{{apiKey}}'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-appwrite-jwt", "{{apiKey}}")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/account/sessions/:sessionId' -Method GET -Headers $headers
$headers=@{}
$headers.Add("x-appwrite-jwt", "{{apiKey}}")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/account/sessions/:sessionId' -Method GET -Headers $headers
import http.client
conn = http.client.HTTPSConnection("example.com")
headers = { 'x-appwrite-jwt': "{{apiKey}}" }
conn.request("GET", "/baseUrl/account/sessions/:sessionId", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/account/sessions/:sessionId"
headers = {"x-appwrite-jwt": "{{apiKey}}"}
response = requests.get(url, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/account/sessions/:sessionId"
response <- VERB("GET", url, add_headers('x-appwrite-jwt' = '{{apiKey}}'), content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/account/sessions/:sessionId")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-appwrite-jwt"] = '{{apiKey}}'
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/account/sessions/:sessionId') do |req|
req.headers['x-appwrite-jwt'] = '{{apiKey}}'
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/account/sessions/:sessionId";
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-appwrite-jwt", "{{apiKey}}".parse().unwrap());
let client = reqwest::Client::new();
let response = client.get(url)
.headers(headers)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/account/sessions/:sessionId \
--header 'x-appwrite-jwt: {{apiKey}}'
http GET {{baseUrl}}/account/sessions/:sessionId \
x-appwrite-jwt:'{{apiKey}}'
wget --quiet \
--method GET \
--header 'x-appwrite-jwt: {{apiKey}}' \
--output-document \
- {{baseUrl}}/account/sessions/:sessionId
import Foundation
let headers = ["x-appwrite-jwt": "{{apiKey}}"]
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/account/sessions/:sessionId")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PATCH
Update Account Email
{{baseUrl}}/account/email
HEADERS
X-Appwrite-JWT
{{apiKey}}
BODY json
{
"email": "",
"password": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PATCH");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/account/email");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-appwrite-jwt: {{apiKey}}");
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"email\": \"\",\n \"password\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/patch "{{baseUrl}}/account/email" {:headers {:x-appwrite-jwt "{{apiKey}}"}
:content-type :json
:form-params {:email ""
:password ""}})
require "http/client"
url = "{{baseUrl}}/account/email"
headers = HTTP::Headers{
"x-appwrite-jwt" => "{{apiKey}}"
"content-type" => "application/json"
}
reqBody = "{\n \"email\": \"\",\n \"password\": \"\"\n}"
response = HTTP::Client.patch url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Patch,
RequestUri = new Uri("{{baseUrl}}/account/email"),
Headers =
{
{ "x-appwrite-jwt", "{{apiKey}}" },
},
Content = new StringContent("{\n \"email\": \"\",\n \"password\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/account/email");
var request = new RestRequest("", Method.Patch);
request.AddHeader("x-appwrite-jwt", "{{apiKey}}");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"email\": \"\",\n \"password\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/account/email"
payload := strings.NewReader("{\n \"email\": \"\",\n \"password\": \"\"\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("x-appwrite-jwt", "{{apiKey}}")
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
PATCH /baseUrl/account/email HTTP/1.1
X-Appwrite-Jwt: {{apiKey}}
Content-Type: application/json
Host: example.com
Content-Length: 35
{
"email": "",
"password": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PATCH", "{{baseUrl}}/account/email")
.setHeader("x-appwrite-jwt", "{{apiKey}}")
.setHeader("content-type", "application/json")
.setBody("{\n \"email\": \"\",\n \"password\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/account/email"))
.header("x-appwrite-jwt", "{{apiKey}}")
.header("content-type", "application/json")
.method("PATCH", HttpRequest.BodyPublishers.ofString("{\n \"email\": \"\",\n \"password\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"email\": \"\",\n \"password\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/account/email")
.patch(body)
.addHeader("x-appwrite-jwt", "{{apiKey}}")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.patch("{{baseUrl}}/account/email")
.header("x-appwrite-jwt", "{{apiKey}}")
.header("content-type", "application/json")
.body("{\n \"email\": \"\",\n \"password\": \"\"\n}")
.asString();
const data = JSON.stringify({
email: '',
password: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PATCH', '{{baseUrl}}/account/email');
xhr.setRequestHeader('x-appwrite-jwt', '{{apiKey}}');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PATCH',
url: '{{baseUrl}}/account/email',
headers: {'x-appwrite-jwt': '{{apiKey}}', 'content-type': 'application/json'},
data: {email: '', password: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/account/email';
const options = {
method: 'PATCH',
headers: {'x-appwrite-jwt': '{{apiKey}}', 'content-type': 'application/json'},
body: '{"email":"","password":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/account/email',
method: 'PATCH',
headers: {
'x-appwrite-jwt': '{{apiKey}}',
'content-type': 'application/json'
},
processData: false,
data: '{\n "email": "",\n "password": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"email\": \"\",\n \"password\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/account/email")
.patch(body)
.addHeader("x-appwrite-jwt", "{{apiKey}}")
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'PATCH',
hostname: 'example.com',
port: null,
path: '/baseUrl/account/email',
headers: {
'x-appwrite-jwt': '{{apiKey}}',
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({email: '', password: ''}));
req.end();
const request = require('request');
const options = {
method: 'PATCH',
url: '{{baseUrl}}/account/email',
headers: {'x-appwrite-jwt': '{{apiKey}}', 'content-type': 'application/json'},
body: {email: '', password: ''},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('PATCH', '{{baseUrl}}/account/email');
req.headers({
'x-appwrite-jwt': '{{apiKey}}',
'content-type': 'application/json'
});
req.type('json');
req.send({
email: '',
password: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'PATCH',
url: '{{baseUrl}}/account/email',
headers: {'x-appwrite-jwt': '{{apiKey}}', 'content-type': 'application/json'},
data: {email: '', password: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/account/email';
const options = {
method: 'PATCH',
headers: {'x-appwrite-jwt': '{{apiKey}}', 'content-type': 'application/json'},
body: '{"email":"","password":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-appwrite-jwt": @"{{apiKey}}",
@"content-type": @"application/json" };
NSDictionary *parameters = @{ @"email": @"",
@"password": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/account/email"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"PATCH"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/account/email" in
let headers = Header.add_list (Header.init ()) [
("x-appwrite-jwt", "{{apiKey}}");
("content-type", "application/json");
] in
let body = Cohttp_lwt_body.of_string "{\n \"email\": \"\",\n \"password\": \"\"\n}" in
Client.call ~headers ~body `PATCH uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/account/email",
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([
'email' => '',
'password' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json",
"x-appwrite-jwt: {{apiKey}}"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('PATCH', '{{baseUrl}}/account/email', [
'body' => '{
"email": "",
"password": ""
}',
'headers' => [
'content-type' => 'application/json',
'x-appwrite-jwt' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/account/email');
$request->setMethod(HttpRequest::HTTP_METH_PATCH);
$request->setHeaders([
'x-appwrite-jwt' => '{{apiKey}}',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'email' => '',
'password' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'email' => '',
'password' => ''
]));
$request->setRequestUrl('{{baseUrl}}/account/email');
$request->setRequestMethod('PATCH');
$request->setBody($body);
$request->setHeaders([
'x-appwrite-jwt' => '{{apiKey}}',
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-appwrite-jwt", "{{apiKey}}")
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/account/email' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"email": "",
"password": ""
}'
$headers=@{}
$headers.Add("x-appwrite-jwt", "{{apiKey}}")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/account/email' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"email": "",
"password": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"email\": \"\",\n \"password\": \"\"\n}"
headers = {
'x-appwrite-jwt': "{{apiKey}}",
'content-type': "application/json"
}
conn.request("PATCH", "/baseUrl/account/email", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/account/email"
payload = {
"email": "",
"password": ""
}
headers = {
"x-appwrite-jwt": "{{apiKey}}",
"content-type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/account/email"
payload <- "{\n \"email\": \"\",\n \"password\": \"\"\n}"
encode <- "json"
response <- VERB("PATCH", url, body = payload, add_headers('x-appwrite-jwt' = '{{apiKey}}'), content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/account/email")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["x-appwrite-jwt"] = '{{apiKey}}'
request["content-type"] = 'application/json'
request.body = "{\n \"email\": \"\",\n \"password\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.patch('/baseUrl/account/email') do |req|
req.headers['x-appwrite-jwt'] = '{{apiKey}}'
req.body = "{\n \"email\": \"\",\n \"password\": \"\"\n}"
end
puts response.status
puts response.body
use std::str::FromStr;
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/account/email";
let payload = json!({
"email": "",
"password": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-appwrite-jwt", "{{apiKey}}".parse().unwrap());
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("PATCH").unwrap(), url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request PATCH \
--url {{baseUrl}}/account/email \
--header 'content-type: application/json' \
--header 'x-appwrite-jwt: {{apiKey}}' \
--data '{
"email": "",
"password": ""
}'
echo '{
"email": "",
"password": ""
}' | \
http PATCH {{baseUrl}}/account/email \
content-type:application/json \
x-appwrite-jwt:'{{apiKey}}'
wget --quiet \
--method PATCH \
--header 'x-appwrite-jwt: {{apiKey}}' \
--header 'content-type: application/json' \
--body-data '{\n "email": "",\n "password": ""\n}' \
--output-document \
- {{baseUrl}}/account/email
import Foundation
let headers = [
"x-appwrite-jwt": "{{apiKey}}",
"content-type": "application/json"
]
let parameters = [
"email": "",
"password": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/account/email")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PATCH"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PATCH
Update Account Name
{{baseUrl}}/account/name
HEADERS
X-Appwrite-JWT
{{apiKey}}
BODY json
{
"name": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PATCH");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/account/name");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-appwrite-jwt: {{apiKey}}");
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"name\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/patch "{{baseUrl}}/account/name" {:headers {:x-appwrite-jwt "{{apiKey}}"}
:content-type :json
:form-params {:name ""}})
require "http/client"
url = "{{baseUrl}}/account/name"
headers = HTTP::Headers{
"x-appwrite-jwt" => "{{apiKey}}"
"content-type" => "application/json"
}
reqBody = "{\n \"name\": \"\"\n}"
response = HTTP::Client.patch url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Patch,
RequestUri = new Uri("{{baseUrl}}/account/name"),
Headers =
{
{ "x-appwrite-jwt", "{{apiKey}}" },
},
Content = new StringContent("{\n \"name\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/account/name");
var request = new RestRequest("", Method.Patch);
request.AddHeader("x-appwrite-jwt", "{{apiKey}}");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"name\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/account/name"
payload := strings.NewReader("{\n \"name\": \"\"\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("x-appwrite-jwt", "{{apiKey}}")
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
PATCH /baseUrl/account/name HTTP/1.1
X-Appwrite-Jwt: {{apiKey}}
Content-Type: application/json
Host: example.com
Content-Length: 16
{
"name": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PATCH", "{{baseUrl}}/account/name")
.setHeader("x-appwrite-jwt", "{{apiKey}}")
.setHeader("content-type", "application/json")
.setBody("{\n \"name\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/account/name"))
.header("x-appwrite-jwt", "{{apiKey}}")
.header("content-type", "application/json")
.method("PATCH", HttpRequest.BodyPublishers.ofString("{\n \"name\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"name\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/account/name")
.patch(body)
.addHeader("x-appwrite-jwt", "{{apiKey}}")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.patch("{{baseUrl}}/account/name")
.header("x-appwrite-jwt", "{{apiKey}}")
.header("content-type", "application/json")
.body("{\n \"name\": \"\"\n}")
.asString();
const data = JSON.stringify({
name: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PATCH', '{{baseUrl}}/account/name');
xhr.setRequestHeader('x-appwrite-jwt', '{{apiKey}}');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PATCH',
url: '{{baseUrl}}/account/name',
headers: {'x-appwrite-jwt': '{{apiKey}}', 'content-type': 'application/json'},
data: {name: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/account/name';
const options = {
method: 'PATCH',
headers: {'x-appwrite-jwt': '{{apiKey}}', 'content-type': 'application/json'},
body: '{"name":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/account/name',
method: 'PATCH',
headers: {
'x-appwrite-jwt': '{{apiKey}}',
'content-type': 'application/json'
},
processData: false,
data: '{\n "name": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"name\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/account/name")
.patch(body)
.addHeader("x-appwrite-jwt", "{{apiKey}}")
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'PATCH',
hostname: 'example.com',
port: null,
path: '/baseUrl/account/name',
headers: {
'x-appwrite-jwt': '{{apiKey}}',
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({name: ''}));
req.end();
const request = require('request');
const options = {
method: 'PATCH',
url: '{{baseUrl}}/account/name',
headers: {'x-appwrite-jwt': '{{apiKey}}', 'content-type': 'application/json'},
body: {name: ''},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('PATCH', '{{baseUrl}}/account/name');
req.headers({
'x-appwrite-jwt': '{{apiKey}}',
'content-type': 'application/json'
});
req.type('json');
req.send({
name: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'PATCH',
url: '{{baseUrl}}/account/name',
headers: {'x-appwrite-jwt': '{{apiKey}}', 'content-type': 'application/json'},
data: {name: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/account/name';
const options = {
method: 'PATCH',
headers: {'x-appwrite-jwt': '{{apiKey}}', 'content-type': 'application/json'},
body: '{"name":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-appwrite-jwt": @"{{apiKey}}",
@"content-type": @"application/json" };
NSDictionary *parameters = @{ @"name": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/account/name"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"PATCH"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/account/name" in
let headers = Header.add_list (Header.init ()) [
("x-appwrite-jwt", "{{apiKey}}");
("content-type", "application/json");
] in
let body = Cohttp_lwt_body.of_string "{\n \"name\": \"\"\n}" in
Client.call ~headers ~body `PATCH uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/account/name",
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' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json",
"x-appwrite-jwt: {{apiKey}}"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('PATCH', '{{baseUrl}}/account/name', [
'body' => '{
"name": ""
}',
'headers' => [
'content-type' => 'application/json',
'x-appwrite-jwt' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/account/name');
$request->setMethod(HttpRequest::HTTP_METH_PATCH);
$request->setHeaders([
'x-appwrite-jwt' => '{{apiKey}}',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'name' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'name' => ''
]));
$request->setRequestUrl('{{baseUrl}}/account/name');
$request->setRequestMethod('PATCH');
$request->setBody($body);
$request->setHeaders([
'x-appwrite-jwt' => '{{apiKey}}',
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-appwrite-jwt", "{{apiKey}}")
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/account/name' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"name": ""
}'
$headers=@{}
$headers.Add("x-appwrite-jwt", "{{apiKey}}")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/account/name' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"name": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"name\": \"\"\n}"
headers = {
'x-appwrite-jwt': "{{apiKey}}",
'content-type': "application/json"
}
conn.request("PATCH", "/baseUrl/account/name", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/account/name"
payload = { "name": "" }
headers = {
"x-appwrite-jwt": "{{apiKey}}",
"content-type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/account/name"
payload <- "{\n \"name\": \"\"\n}"
encode <- "json"
response <- VERB("PATCH", url, body = payload, add_headers('x-appwrite-jwt' = '{{apiKey}}'), content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/account/name")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["x-appwrite-jwt"] = '{{apiKey}}'
request["content-type"] = 'application/json'
request.body = "{\n \"name\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.patch('/baseUrl/account/name') do |req|
req.headers['x-appwrite-jwt'] = '{{apiKey}}'
req.body = "{\n \"name\": \"\"\n}"
end
puts response.status
puts response.body
use std::str::FromStr;
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/account/name";
let payload = json!({"name": ""});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-appwrite-jwt", "{{apiKey}}".parse().unwrap());
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("PATCH").unwrap(), url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request PATCH \
--url {{baseUrl}}/account/name \
--header 'content-type: application/json' \
--header 'x-appwrite-jwt: {{apiKey}}' \
--data '{
"name": ""
}'
echo '{
"name": ""
}' | \
http PATCH {{baseUrl}}/account/name \
content-type:application/json \
x-appwrite-jwt:'{{apiKey}}'
wget --quiet \
--method PATCH \
--header 'x-appwrite-jwt: {{apiKey}}' \
--header 'content-type: application/json' \
--body-data '{\n "name": ""\n}' \
--output-document \
- {{baseUrl}}/account/name
import Foundation
let headers = [
"x-appwrite-jwt": "{{apiKey}}",
"content-type": "application/json"
]
let parameters = ["name": ""] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/account/name")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PATCH"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PATCH
Update Account Password
{{baseUrl}}/account/password
HEADERS
X-Appwrite-JWT
{{apiKey}}
BODY json
{
"oldPassword": "",
"password": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PATCH");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/account/password");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-appwrite-jwt: {{apiKey}}");
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"oldPassword\": \"\",\n \"password\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/patch "{{baseUrl}}/account/password" {:headers {:x-appwrite-jwt "{{apiKey}}"}
:content-type :json
:form-params {:oldPassword ""
:password ""}})
require "http/client"
url = "{{baseUrl}}/account/password"
headers = HTTP::Headers{
"x-appwrite-jwt" => "{{apiKey}}"
"content-type" => "application/json"
}
reqBody = "{\n \"oldPassword\": \"\",\n \"password\": \"\"\n}"
response = HTTP::Client.patch url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Patch,
RequestUri = new Uri("{{baseUrl}}/account/password"),
Headers =
{
{ "x-appwrite-jwt", "{{apiKey}}" },
},
Content = new StringContent("{\n \"oldPassword\": \"\",\n \"password\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/account/password");
var request = new RestRequest("", Method.Patch);
request.AddHeader("x-appwrite-jwt", "{{apiKey}}");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"oldPassword\": \"\",\n \"password\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/account/password"
payload := strings.NewReader("{\n \"oldPassword\": \"\",\n \"password\": \"\"\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("x-appwrite-jwt", "{{apiKey}}")
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
PATCH /baseUrl/account/password HTTP/1.1
X-Appwrite-Jwt: {{apiKey}}
Content-Type: application/json
Host: example.com
Content-Length: 41
{
"oldPassword": "",
"password": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PATCH", "{{baseUrl}}/account/password")
.setHeader("x-appwrite-jwt", "{{apiKey}}")
.setHeader("content-type", "application/json")
.setBody("{\n \"oldPassword\": \"\",\n \"password\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/account/password"))
.header("x-appwrite-jwt", "{{apiKey}}")
.header("content-type", "application/json")
.method("PATCH", HttpRequest.BodyPublishers.ofString("{\n \"oldPassword\": \"\",\n \"password\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"oldPassword\": \"\",\n \"password\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/account/password")
.patch(body)
.addHeader("x-appwrite-jwt", "{{apiKey}}")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.patch("{{baseUrl}}/account/password")
.header("x-appwrite-jwt", "{{apiKey}}")
.header("content-type", "application/json")
.body("{\n \"oldPassword\": \"\",\n \"password\": \"\"\n}")
.asString();
const data = JSON.stringify({
oldPassword: '',
password: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PATCH', '{{baseUrl}}/account/password');
xhr.setRequestHeader('x-appwrite-jwt', '{{apiKey}}');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PATCH',
url: '{{baseUrl}}/account/password',
headers: {'x-appwrite-jwt': '{{apiKey}}', 'content-type': 'application/json'},
data: {oldPassword: '', password: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/account/password';
const options = {
method: 'PATCH',
headers: {'x-appwrite-jwt': '{{apiKey}}', 'content-type': 'application/json'},
body: '{"oldPassword":"","password":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/account/password',
method: 'PATCH',
headers: {
'x-appwrite-jwt': '{{apiKey}}',
'content-type': 'application/json'
},
processData: false,
data: '{\n "oldPassword": "",\n "password": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"oldPassword\": \"\",\n \"password\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/account/password")
.patch(body)
.addHeader("x-appwrite-jwt", "{{apiKey}}")
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'PATCH',
hostname: 'example.com',
port: null,
path: '/baseUrl/account/password',
headers: {
'x-appwrite-jwt': '{{apiKey}}',
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({oldPassword: '', password: ''}));
req.end();
const request = require('request');
const options = {
method: 'PATCH',
url: '{{baseUrl}}/account/password',
headers: {'x-appwrite-jwt': '{{apiKey}}', 'content-type': 'application/json'},
body: {oldPassword: '', password: ''},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('PATCH', '{{baseUrl}}/account/password');
req.headers({
'x-appwrite-jwt': '{{apiKey}}',
'content-type': 'application/json'
});
req.type('json');
req.send({
oldPassword: '',
password: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'PATCH',
url: '{{baseUrl}}/account/password',
headers: {'x-appwrite-jwt': '{{apiKey}}', 'content-type': 'application/json'},
data: {oldPassword: '', password: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/account/password';
const options = {
method: 'PATCH',
headers: {'x-appwrite-jwt': '{{apiKey}}', 'content-type': 'application/json'},
body: '{"oldPassword":"","password":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-appwrite-jwt": @"{{apiKey}}",
@"content-type": @"application/json" };
NSDictionary *parameters = @{ @"oldPassword": @"",
@"password": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/account/password"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"PATCH"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/account/password" in
let headers = Header.add_list (Header.init ()) [
("x-appwrite-jwt", "{{apiKey}}");
("content-type", "application/json");
] in
let body = Cohttp_lwt_body.of_string "{\n \"oldPassword\": \"\",\n \"password\": \"\"\n}" in
Client.call ~headers ~body `PATCH uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/account/password",
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([
'oldPassword' => '',
'password' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json",
"x-appwrite-jwt: {{apiKey}}"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('PATCH', '{{baseUrl}}/account/password', [
'body' => '{
"oldPassword": "",
"password": ""
}',
'headers' => [
'content-type' => 'application/json',
'x-appwrite-jwt' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/account/password');
$request->setMethod(HttpRequest::HTTP_METH_PATCH);
$request->setHeaders([
'x-appwrite-jwt' => '{{apiKey}}',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'oldPassword' => '',
'password' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'oldPassword' => '',
'password' => ''
]));
$request->setRequestUrl('{{baseUrl}}/account/password');
$request->setRequestMethod('PATCH');
$request->setBody($body);
$request->setHeaders([
'x-appwrite-jwt' => '{{apiKey}}',
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-appwrite-jwt", "{{apiKey}}")
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/account/password' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"oldPassword": "",
"password": ""
}'
$headers=@{}
$headers.Add("x-appwrite-jwt", "{{apiKey}}")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/account/password' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"oldPassword": "",
"password": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"oldPassword\": \"\",\n \"password\": \"\"\n}"
headers = {
'x-appwrite-jwt': "{{apiKey}}",
'content-type': "application/json"
}
conn.request("PATCH", "/baseUrl/account/password", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/account/password"
payload = {
"oldPassword": "",
"password": ""
}
headers = {
"x-appwrite-jwt": "{{apiKey}}",
"content-type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/account/password"
payload <- "{\n \"oldPassword\": \"\",\n \"password\": \"\"\n}"
encode <- "json"
response <- VERB("PATCH", url, body = payload, add_headers('x-appwrite-jwt' = '{{apiKey}}'), content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/account/password")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["x-appwrite-jwt"] = '{{apiKey}}'
request["content-type"] = 'application/json'
request.body = "{\n \"oldPassword\": \"\",\n \"password\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.patch('/baseUrl/account/password') do |req|
req.headers['x-appwrite-jwt'] = '{{apiKey}}'
req.body = "{\n \"oldPassword\": \"\",\n \"password\": \"\"\n}"
end
puts response.status
puts response.body
use std::str::FromStr;
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/account/password";
let payload = json!({
"oldPassword": "",
"password": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-appwrite-jwt", "{{apiKey}}".parse().unwrap());
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("PATCH").unwrap(), url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request PATCH \
--url {{baseUrl}}/account/password \
--header 'content-type: application/json' \
--header 'x-appwrite-jwt: {{apiKey}}' \
--data '{
"oldPassword": "",
"password": ""
}'
echo '{
"oldPassword": "",
"password": ""
}' | \
http PATCH {{baseUrl}}/account/password \
content-type:application/json \
x-appwrite-jwt:'{{apiKey}}'
wget --quiet \
--method PATCH \
--header 'x-appwrite-jwt: {{apiKey}}' \
--header 'content-type: application/json' \
--body-data '{\n "oldPassword": "",\n "password": ""\n}' \
--output-document \
- {{baseUrl}}/account/password
import Foundation
let headers = [
"x-appwrite-jwt": "{{apiKey}}",
"content-type": "application/json"
]
let parameters = [
"oldPassword": "",
"password": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/account/password")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PATCH"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PATCH
Update Account Preferences
{{baseUrl}}/account/prefs
HEADERS
X-Appwrite-JWT
{{apiKey}}
BODY json
{
"prefs": {}
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PATCH");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/account/prefs");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-appwrite-jwt: {{apiKey}}");
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"prefs\": {}\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/patch "{{baseUrl}}/account/prefs" {:headers {:x-appwrite-jwt "{{apiKey}}"}
:content-type :json
:form-params {:prefs {}}})
require "http/client"
url = "{{baseUrl}}/account/prefs"
headers = HTTP::Headers{
"x-appwrite-jwt" => "{{apiKey}}"
"content-type" => "application/json"
}
reqBody = "{\n \"prefs\": {}\n}"
response = HTTP::Client.patch url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Patch,
RequestUri = new Uri("{{baseUrl}}/account/prefs"),
Headers =
{
{ "x-appwrite-jwt", "{{apiKey}}" },
},
Content = new StringContent("{\n \"prefs\": {}\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/account/prefs");
var request = new RestRequest("", Method.Patch);
request.AddHeader("x-appwrite-jwt", "{{apiKey}}");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"prefs\": {}\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/account/prefs"
payload := strings.NewReader("{\n \"prefs\": {}\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("x-appwrite-jwt", "{{apiKey}}")
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
PATCH /baseUrl/account/prefs HTTP/1.1
X-Appwrite-Jwt: {{apiKey}}
Content-Type: application/json
Host: example.com
Content-Length: 17
{
"prefs": {}
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PATCH", "{{baseUrl}}/account/prefs")
.setHeader("x-appwrite-jwt", "{{apiKey}}")
.setHeader("content-type", "application/json")
.setBody("{\n \"prefs\": {}\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/account/prefs"))
.header("x-appwrite-jwt", "{{apiKey}}")
.header("content-type", "application/json")
.method("PATCH", HttpRequest.BodyPublishers.ofString("{\n \"prefs\": {}\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"prefs\": {}\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/account/prefs")
.patch(body)
.addHeader("x-appwrite-jwt", "{{apiKey}}")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.patch("{{baseUrl}}/account/prefs")
.header("x-appwrite-jwt", "{{apiKey}}")
.header("content-type", "application/json")
.body("{\n \"prefs\": {}\n}")
.asString();
const data = JSON.stringify({
prefs: {}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PATCH', '{{baseUrl}}/account/prefs');
xhr.setRequestHeader('x-appwrite-jwt', '{{apiKey}}');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PATCH',
url: '{{baseUrl}}/account/prefs',
headers: {'x-appwrite-jwt': '{{apiKey}}', 'content-type': 'application/json'},
data: {prefs: {}}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/account/prefs';
const options = {
method: 'PATCH',
headers: {'x-appwrite-jwt': '{{apiKey}}', 'content-type': 'application/json'},
body: '{"prefs":{}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/account/prefs',
method: 'PATCH',
headers: {
'x-appwrite-jwt': '{{apiKey}}',
'content-type': 'application/json'
},
processData: false,
data: '{\n "prefs": {}\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"prefs\": {}\n}")
val request = Request.Builder()
.url("{{baseUrl}}/account/prefs")
.patch(body)
.addHeader("x-appwrite-jwt", "{{apiKey}}")
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'PATCH',
hostname: 'example.com',
port: null,
path: '/baseUrl/account/prefs',
headers: {
'x-appwrite-jwt': '{{apiKey}}',
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({prefs: {}}));
req.end();
const request = require('request');
const options = {
method: 'PATCH',
url: '{{baseUrl}}/account/prefs',
headers: {'x-appwrite-jwt': '{{apiKey}}', 'content-type': 'application/json'},
body: {prefs: {}},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('PATCH', '{{baseUrl}}/account/prefs');
req.headers({
'x-appwrite-jwt': '{{apiKey}}',
'content-type': 'application/json'
});
req.type('json');
req.send({
prefs: {}
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'PATCH',
url: '{{baseUrl}}/account/prefs',
headers: {'x-appwrite-jwt': '{{apiKey}}', 'content-type': 'application/json'},
data: {prefs: {}}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/account/prefs';
const options = {
method: 'PATCH',
headers: {'x-appwrite-jwt': '{{apiKey}}', 'content-type': 'application/json'},
body: '{"prefs":{}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-appwrite-jwt": @"{{apiKey}}",
@"content-type": @"application/json" };
NSDictionary *parameters = @{ @"prefs": @{ } };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/account/prefs"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"PATCH"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/account/prefs" in
let headers = Header.add_list (Header.init ()) [
("x-appwrite-jwt", "{{apiKey}}");
("content-type", "application/json");
] in
let body = Cohttp_lwt_body.of_string "{\n \"prefs\": {}\n}" in
Client.call ~headers ~body `PATCH uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/account/prefs",
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([
'prefs' => [
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json",
"x-appwrite-jwt: {{apiKey}}"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('PATCH', '{{baseUrl}}/account/prefs', [
'body' => '{
"prefs": {}
}',
'headers' => [
'content-type' => 'application/json',
'x-appwrite-jwt' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/account/prefs');
$request->setMethod(HttpRequest::HTTP_METH_PATCH);
$request->setHeaders([
'x-appwrite-jwt' => '{{apiKey}}',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'prefs' => [
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'prefs' => [
]
]));
$request->setRequestUrl('{{baseUrl}}/account/prefs');
$request->setRequestMethod('PATCH');
$request->setBody($body);
$request->setHeaders([
'x-appwrite-jwt' => '{{apiKey}}',
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-appwrite-jwt", "{{apiKey}}")
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/account/prefs' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"prefs": {}
}'
$headers=@{}
$headers.Add("x-appwrite-jwt", "{{apiKey}}")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/account/prefs' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"prefs": {}
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"prefs\": {}\n}"
headers = {
'x-appwrite-jwt': "{{apiKey}}",
'content-type': "application/json"
}
conn.request("PATCH", "/baseUrl/account/prefs", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/account/prefs"
payload = { "prefs": {} }
headers = {
"x-appwrite-jwt": "{{apiKey}}",
"content-type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/account/prefs"
payload <- "{\n \"prefs\": {}\n}"
encode <- "json"
response <- VERB("PATCH", url, body = payload, add_headers('x-appwrite-jwt' = '{{apiKey}}'), content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/account/prefs")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["x-appwrite-jwt"] = '{{apiKey}}'
request["content-type"] = 'application/json'
request.body = "{\n \"prefs\": {}\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.patch('/baseUrl/account/prefs') do |req|
req.headers['x-appwrite-jwt'] = '{{apiKey}}'
req.body = "{\n \"prefs\": {}\n}"
end
puts response.status
puts response.body
use std::str::FromStr;
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/account/prefs";
let payload = json!({"prefs": json!({})});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-appwrite-jwt", "{{apiKey}}".parse().unwrap());
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("PATCH").unwrap(), url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request PATCH \
--url {{baseUrl}}/account/prefs \
--header 'content-type: application/json' \
--header 'x-appwrite-jwt: {{apiKey}}' \
--data '{
"prefs": {}
}'
echo '{
"prefs": {}
}' | \
http PATCH {{baseUrl}}/account/prefs \
content-type:application/json \
x-appwrite-jwt:'{{apiKey}}'
wget --quiet \
--method PATCH \
--header 'x-appwrite-jwt: {{apiKey}}' \
--header 'content-type: application/json' \
--body-data '{\n "prefs": {}\n}' \
--output-document \
- {{baseUrl}}/account/prefs
import Foundation
let headers = [
"x-appwrite-jwt": "{{apiKey}}",
"content-type": "application/json"
]
let parameters = ["prefs": []] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/account/prefs")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PATCH"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
Get Browser Icon
{{baseUrl}}/avatars/browsers/:code
HEADERS
X-Appwrite-JWT
{{apiKey}}
QUERY PARAMS
code
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/avatars/browsers/:code");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-appwrite-jwt: {{apiKey}}");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/avatars/browsers/:code" {:headers {:x-appwrite-jwt "{{apiKey}}"}})
require "http/client"
url = "{{baseUrl}}/avatars/browsers/:code"
headers = HTTP::Headers{
"x-appwrite-jwt" => "{{apiKey}}"
}
response = HTTP::Client.get url, headers: headers
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/avatars/browsers/:code"),
Headers =
{
{ "x-appwrite-jwt", "{{apiKey}}" },
},
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/avatars/browsers/:code");
var request = new RestRequest("", Method.Get);
request.AddHeader("x-appwrite-jwt", "{{apiKey}}");
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/avatars/browsers/:code"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-appwrite-jwt", "{{apiKey}}")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/avatars/browsers/:code HTTP/1.1
X-Appwrite-Jwt: {{apiKey}}
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/avatars/browsers/:code")
.setHeader("x-appwrite-jwt", "{{apiKey}}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/avatars/browsers/:code"))
.header("x-appwrite-jwt", "{{apiKey}}")
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/avatars/browsers/:code")
.get()
.addHeader("x-appwrite-jwt", "{{apiKey}}")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/avatars/browsers/:code")
.header("x-appwrite-jwt", "{{apiKey}}")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/avatars/browsers/:code');
xhr.setRequestHeader('x-appwrite-jwt', '{{apiKey}}');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/avatars/browsers/:code',
headers: {'x-appwrite-jwt': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/avatars/browsers/:code';
const options = {method: 'GET', headers: {'x-appwrite-jwt': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/avatars/browsers/:code',
method: 'GET',
headers: {
'x-appwrite-jwt': '{{apiKey}}'
}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/avatars/browsers/:code")
.get()
.addHeader("x-appwrite-jwt", "{{apiKey}}")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/avatars/browsers/:code',
headers: {
'x-appwrite-jwt': '{{apiKey}}'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/avatars/browsers/:code',
headers: {'x-appwrite-jwt': '{{apiKey}}'}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/avatars/browsers/:code');
req.headers({
'x-appwrite-jwt': '{{apiKey}}'
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/avatars/browsers/:code',
headers: {'x-appwrite-jwt': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/avatars/browsers/:code';
const options = {method: 'GET', headers: {'x-appwrite-jwt': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-appwrite-jwt": @"{{apiKey}}" };
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/avatars/browsers/:code"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
[request setAllHTTPHeaderFields:headers];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/avatars/browsers/:code" in
let headers = Header.add (Header.init ()) "x-appwrite-jwt" "{{apiKey}}" in
Client.call ~headers `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/avatars/browsers/:code",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-appwrite-jwt: {{apiKey}}"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/avatars/browsers/:code', [
'headers' => [
'x-appwrite-jwt' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/avatars/browsers/:code');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders([
'x-appwrite-jwt' => '{{apiKey}}'
]);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/avatars/browsers/:code');
$request->setRequestMethod('GET');
$request->setHeaders([
'x-appwrite-jwt' => '{{apiKey}}'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-appwrite-jwt", "{{apiKey}}")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/avatars/browsers/:code' -Method GET -Headers $headers
$headers=@{}
$headers.Add("x-appwrite-jwt", "{{apiKey}}")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/avatars/browsers/:code' -Method GET -Headers $headers
import http.client
conn = http.client.HTTPSConnection("example.com")
headers = { 'x-appwrite-jwt': "{{apiKey}}" }
conn.request("GET", "/baseUrl/avatars/browsers/:code", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/avatars/browsers/:code"
headers = {"x-appwrite-jwt": "{{apiKey}}"}
response = requests.get(url, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/avatars/browsers/:code"
response <- VERB("GET", url, add_headers('x-appwrite-jwt' = '{{apiKey}}'), content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/avatars/browsers/:code")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-appwrite-jwt"] = '{{apiKey}}'
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/avatars/browsers/:code') do |req|
req.headers['x-appwrite-jwt'] = '{{apiKey}}'
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/avatars/browsers/:code";
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-appwrite-jwt", "{{apiKey}}".parse().unwrap());
let client = reqwest::Client::new();
let response = client.get(url)
.headers(headers)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/avatars/browsers/:code \
--header 'x-appwrite-jwt: {{apiKey}}'
http GET {{baseUrl}}/avatars/browsers/:code \
x-appwrite-jwt:'{{apiKey}}'
wget --quiet \
--method GET \
--header 'x-appwrite-jwt: {{apiKey}}' \
--output-document \
- {{baseUrl}}/avatars/browsers/:code
import Foundation
let headers = ["x-appwrite-jwt": "{{apiKey}}"]
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/avatars/browsers/:code")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
Get Country Flag
{{baseUrl}}/avatars/flags/:code
HEADERS
X-Appwrite-JWT
{{apiKey}}
QUERY PARAMS
code
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/avatars/flags/:code");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-appwrite-jwt: {{apiKey}}");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/avatars/flags/:code" {:headers {:x-appwrite-jwt "{{apiKey}}"}})
require "http/client"
url = "{{baseUrl}}/avatars/flags/:code"
headers = HTTP::Headers{
"x-appwrite-jwt" => "{{apiKey}}"
}
response = HTTP::Client.get url, headers: headers
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/avatars/flags/:code"),
Headers =
{
{ "x-appwrite-jwt", "{{apiKey}}" },
},
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/avatars/flags/:code");
var request = new RestRequest("", Method.Get);
request.AddHeader("x-appwrite-jwt", "{{apiKey}}");
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/avatars/flags/:code"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-appwrite-jwt", "{{apiKey}}")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/avatars/flags/:code HTTP/1.1
X-Appwrite-Jwt: {{apiKey}}
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/avatars/flags/:code")
.setHeader("x-appwrite-jwt", "{{apiKey}}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/avatars/flags/:code"))
.header("x-appwrite-jwt", "{{apiKey}}")
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/avatars/flags/:code")
.get()
.addHeader("x-appwrite-jwt", "{{apiKey}}")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/avatars/flags/:code")
.header("x-appwrite-jwt", "{{apiKey}}")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/avatars/flags/:code');
xhr.setRequestHeader('x-appwrite-jwt', '{{apiKey}}');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/avatars/flags/:code',
headers: {'x-appwrite-jwt': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/avatars/flags/:code';
const options = {method: 'GET', headers: {'x-appwrite-jwt': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/avatars/flags/:code',
method: 'GET',
headers: {
'x-appwrite-jwt': '{{apiKey}}'
}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/avatars/flags/:code")
.get()
.addHeader("x-appwrite-jwt", "{{apiKey}}")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/avatars/flags/:code',
headers: {
'x-appwrite-jwt': '{{apiKey}}'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/avatars/flags/:code',
headers: {'x-appwrite-jwt': '{{apiKey}}'}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/avatars/flags/:code');
req.headers({
'x-appwrite-jwt': '{{apiKey}}'
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/avatars/flags/:code',
headers: {'x-appwrite-jwt': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/avatars/flags/:code';
const options = {method: 'GET', headers: {'x-appwrite-jwt': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-appwrite-jwt": @"{{apiKey}}" };
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/avatars/flags/:code"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
[request setAllHTTPHeaderFields:headers];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/avatars/flags/:code" in
let headers = Header.add (Header.init ()) "x-appwrite-jwt" "{{apiKey}}" in
Client.call ~headers `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/avatars/flags/:code",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-appwrite-jwt: {{apiKey}}"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/avatars/flags/:code', [
'headers' => [
'x-appwrite-jwt' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/avatars/flags/:code');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders([
'x-appwrite-jwt' => '{{apiKey}}'
]);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/avatars/flags/:code');
$request->setRequestMethod('GET');
$request->setHeaders([
'x-appwrite-jwt' => '{{apiKey}}'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-appwrite-jwt", "{{apiKey}}")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/avatars/flags/:code' -Method GET -Headers $headers
$headers=@{}
$headers.Add("x-appwrite-jwt", "{{apiKey}}")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/avatars/flags/:code' -Method GET -Headers $headers
import http.client
conn = http.client.HTTPSConnection("example.com")
headers = { 'x-appwrite-jwt': "{{apiKey}}" }
conn.request("GET", "/baseUrl/avatars/flags/:code", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/avatars/flags/:code"
headers = {"x-appwrite-jwt": "{{apiKey}}"}
response = requests.get(url, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/avatars/flags/:code"
response <- VERB("GET", url, add_headers('x-appwrite-jwt' = '{{apiKey}}'), content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/avatars/flags/:code")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-appwrite-jwt"] = '{{apiKey}}'
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/avatars/flags/:code') do |req|
req.headers['x-appwrite-jwt'] = '{{apiKey}}'
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/avatars/flags/:code";
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-appwrite-jwt", "{{apiKey}}".parse().unwrap());
let client = reqwest::Client::new();
let response = client.get(url)
.headers(headers)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/avatars/flags/:code \
--header 'x-appwrite-jwt: {{apiKey}}'
http GET {{baseUrl}}/avatars/flags/:code \
x-appwrite-jwt:'{{apiKey}}'
wget --quiet \
--method GET \
--header 'x-appwrite-jwt: {{apiKey}}' \
--output-document \
- {{baseUrl}}/avatars/flags/:code
import Foundation
let headers = ["x-appwrite-jwt": "{{apiKey}}"]
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/avatars/flags/:code")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
Get Credit Card Icon
{{baseUrl}}/avatars/credit-cards/:code
HEADERS
X-Appwrite-JWT
{{apiKey}}
QUERY PARAMS
code
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/avatars/credit-cards/:code");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-appwrite-jwt: {{apiKey}}");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/avatars/credit-cards/:code" {:headers {:x-appwrite-jwt "{{apiKey}}"}})
require "http/client"
url = "{{baseUrl}}/avatars/credit-cards/:code"
headers = HTTP::Headers{
"x-appwrite-jwt" => "{{apiKey}}"
}
response = HTTP::Client.get url, headers: headers
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/avatars/credit-cards/:code"),
Headers =
{
{ "x-appwrite-jwt", "{{apiKey}}" },
},
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/avatars/credit-cards/:code");
var request = new RestRequest("", Method.Get);
request.AddHeader("x-appwrite-jwt", "{{apiKey}}");
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/avatars/credit-cards/:code"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-appwrite-jwt", "{{apiKey}}")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/avatars/credit-cards/:code HTTP/1.1
X-Appwrite-Jwt: {{apiKey}}
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/avatars/credit-cards/:code")
.setHeader("x-appwrite-jwt", "{{apiKey}}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/avatars/credit-cards/:code"))
.header("x-appwrite-jwt", "{{apiKey}}")
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/avatars/credit-cards/:code")
.get()
.addHeader("x-appwrite-jwt", "{{apiKey}}")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/avatars/credit-cards/:code")
.header("x-appwrite-jwt", "{{apiKey}}")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/avatars/credit-cards/:code');
xhr.setRequestHeader('x-appwrite-jwt', '{{apiKey}}');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/avatars/credit-cards/:code',
headers: {'x-appwrite-jwt': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/avatars/credit-cards/:code';
const options = {method: 'GET', headers: {'x-appwrite-jwt': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/avatars/credit-cards/:code',
method: 'GET',
headers: {
'x-appwrite-jwt': '{{apiKey}}'
}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/avatars/credit-cards/:code")
.get()
.addHeader("x-appwrite-jwt", "{{apiKey}}")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/avatars/credit-cards/:code',
headers: {
'x-appwrite-jwt': '{{apiKey}}'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/avatars/credit-cards/:code',
headers: {'x-appwrite-jwt': '{{apiKey}}'}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/avatars/credit-cards/:code');
req.headers({
'x-appwrite-jwt': '{{apiKey}}'
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/avatars/credit-cards/:code',
headers: {'x-appwrite-jwt': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/avatars/credit-cards/:code';
const options = {method: 'GET', headers: {'x-appwrite-jwt': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-appwrite-jwt": @"{{apiKey}}" };
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/avatars/credit-cards/:code"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
[request setAllHTTPHeaderFields:headers];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/avatars/credit-cards/:code" in
let headers = Header.add (Header.init ()) "x-appwrite-jwt" "{{apiKey}}" in
Client.call ~headers `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/avatars/credit-cards/:code",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-appwrite-jwt: {{apiKey}}"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/avatars/credit-cards/:code', [
'headers' => [
'x-appwrite-jwt' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/avatars/credit-cards/:code');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders([
'x-appwrite-jwt' => '{{apiKey}}'
]);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/avatars/credit-cards/:code');
$request->setRequestMethod('GET');
$request->setHeaders([
'x-appwrite-jwt' => '{{apiKey}}'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-appwrite-jwt", "{{apiKey}}")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/avatars/credit-cards/:code' -Method GET -Headers $headers
$headers=@{}
$headers.Add("x-appwrite-jwt", "{{apiKey}}")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/avatars/credit-cards/:code' -Method GET -Headers $headers
import http.client
conn = http.client.HTTPSConnection("example.com")
headers = { 'x-appwrite-jwt': "{{apiKey}}" }
conn.request("GET", "/baseUrl/avatars/credit-cards/:code", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/avatars/credit-cards/:code"
headers = {"x-appwrite-jwt": "{{apiKey}}"}
response = requests.get(url, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/avatars/credit-cards/:code"
response <- VERB("GET", url, add_headers('x-appwrite-jwt' = '{{apiKey}}'), content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/avatars/credit-cards/:code")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-appwrite-jwt"] = '{{apiKey}}'
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/avatars/credit-cards/:code') do |req|
req.headers['x-appwrite-jwt'] = '{{apiKey}}'
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/avatars/credit-cards/:code";
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-appwrite-jwt", "{{apiKey}}".parse().unwrap());
let client = reqwest::Client::new();
let response = client.get(url)
.headers(headers)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/avatars/credit-cards/:code \
--header 'x-appwrite-jwt: {{apiKey}}'
http GET {{baseUrl}}/avatars/credit-cards/:code \
x-appwrite-jwt:'{{apiKey}}'
wget --quiet \
--method GET \
--header 'x-appwrite-jwt: {{apiKey}}' \
--output-document \
- {{baseUrl}}/avatars/credit-cards/:code
import Foundation
let headers = ["x-appwrite-jwt": "{{apiKey}}"]
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/avatars/credit-cards/:code")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
Get Favicon
{{baseUrl}}/avatars/favicon
HEADERS
X-Appwrite-JWT
{{apiKey}}
QUERY PARAMS
url
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/avatars/favicon?url=");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-appwrite-jwt: {{apiKey}}");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/avatars/favicon" {:headers {:x-appwrite-jwt "{{apiKey}}"}
:query-params {:url ""}})
require "http/client"
url = "{{baseUrl}}/avatars/favicon?url="
headers = HTTP::Headers{
"x-appwrite-jwt" => "{{apiKey}}"
}
response = HTTP::Client.get url, headers: headers
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/avatars/favicon?url="),
Headers =
{
{ "x-appwrite-jwt", "{{apiKey}}" },
},
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/avatars/favicon?url=");
var request = new RestRequest("", Method.Get);
request.AddHeader("x-appwrite-jwt", "{{apiKey}}");
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/avatars/favicon?url="
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-appwrite-jwt", "{{apiKey}}")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/avatars/favicon?url= HTTP/1.1
X-Appwrite-Jwt: {{apiKey}}
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/avatars/favicon?url=")
.setHeader("x-appwrite-jwt", "{{apiKey}}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/avatars/favicon?url="))
.header("x-appwrite-jwt", "{{apiKey}}")
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/avatars/favicon?url=")
.get()
.addHeader("x-appwrite-jwt", "{{apiKey}}")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/avatars/favicon?url=")
.header("x-appwrite-jwt", "{{apiKey}}")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/avatars/favicon?url=');
xhr.setRequestHeader('x-appwrite-jwt', '{{apiKey}}');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/avatars/favicon',
params: {url: ''},
headers: {'x-appwrite-jwt': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/avatars/favicon?url=';
const options = {method: 'GET', headers: {'x-appwrite-jwt': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/avatars/favicon?url=',
method: 'GET',
headers: {
'x-appwrite-jwt': '{{apiKey}}'
}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/avatars/favicon?url=")
.get()
.addHeader("x-appwrite-jwt", "{{apiKey}}")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/avatars/favicon?url=',
headers: {
'x-appwrite-jwt': '{{apiKey}}'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/avatars/favicon',
qs: {url: ''},
headers: {'x-appwrite-jwt': '{{apiKey}}'}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/avatars/favicon');
req.query({
url: ''
});
req.headers({
'x-appwrite-jwt': '{{apiKey}}'
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/avatars/favicon',
params: {url: ''},
headers: {'x-appwrite-jwt': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/avatars/favicon?url=';
const options = {method: 'GET', headers: {'x-appwrite-jwt': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-appwrite-jwt": @"{{apiKey}}" };
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/avatars/favicon?url="]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
[request setAllHTTPHeaderFields:headers];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/avatars/favicon?url=" in
let headers = Header.add (Header.init ()) "x-appwrite-jwt" "{{apiKey}}" in
Client.call ~headers `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/avatars/favicon?url=",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-appwrite-jwt: {{apiKey}}"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/avatars/favicon?url=', [
'headers' => [
'x-appwrite-jwt' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/avatars/favicon');
$request->setMethod(HTTP_METH_GET);
$request->setQueryData([
'url' => ''
]);
$request->setHeaders([
'x-appwrite-jwt' => '{{apiKey}}'
]);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/avatars/favicon');
$request->setRequestMethod('GET');
$request->setQuery(new http\QueryString([
'url' => ''
]));
$request->setHeaders([
'x-appwrite-jwt' => '{{apiKey}}'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-appwrite-jwt", "{{apiKey}}")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/avatars/favicon?url=' -Method GET -Headers $headers
$headers=@{}
$headers.Add("x-appwrite-jwt", "{{apiKey}}")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/avatars/favicon?url=' -Method GET -Headers $headers
import http.client
conn = http.client.HTTPSConnection("example.com")
headers = { 'x-appwrite-jwt': "{{apiKey}}" }
conn.request("GET", "/baseUrl/avatars/favicon?url=", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/avatars/favicon"
querystring = {"url":""}
headers = {"x-appwrite-jwt": "{{apiKey}}"}
response = requests.get(url, headers=headers, params=querystring)
print(response.json())
library(httr)
url <- "{{baseUrl}}/avatars/favicon"
queryString <- list(url = "")
response <- VERB("GET", url, query = queryString, add_headers('x-appwrite-jwt' = '{{apiKey}}'), content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/avatars/favicon?url=")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-appwrite-jwt"] = '{{apiKey}}'
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/avatars/favicon') do |req|
req.headers['x-appwrite-jwt'] = '{{apiKey}}'
req.params['url'] = ''
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/avatars/favicon";
let querystring = [
("url", ""),
];
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-appwrite-jwt", "{{apiKey}}".parse().unwrap());
let client = reqwest::Client::new();
let response = client.get(url)
.query(&querystring)
.headers(headers)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url '{{baseUrl}}/avatars/favicon?url=' \
--header 'x-appwrite-jwt: {{apiKey}}'
http GET '{{baseUrl}}/avatars/favicon?url=' \
x-appwrite-jwt:'{{apiKey}}'
wget --quiet \
--method GET \
--header 'x-appwrite-jwt: {{apiKey}}' \
--output-document \
- '{{baseUrl}}/avatars/favicon?url='
import Foundation
let headers = ["x-appwrite-jwt": "{{apiKey}}"]
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/avatars/favicon?url=")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
Get Image from URL
{{baseUrl}}/avatars/image
HEADERS
X-Appwrite-JWT
{{apiKey}}
QUERY PARAMS
url
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/avatars/image?url=");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-appwrite-jwt: {{apiKey}}");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/avatars/image" {:headers {:x-appwrite-jwt "{{apiKey}}"}
:query-params {:url ""}})
require "http/client"
url = "{{baseUrl}}/avatars/image?url="
headers = HTTP::Headers{
"x-appwrite-jwt" => "{{apiKey}}"
}
response = HTTP::Client.get url, headers: headers
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/avatars/image?url="),
Headers =
{
{ "x-appwrite-jwt", "{{apiKey}}" },
},
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/avatars/image?url=");
var request = new RestRequest("", Method.Get);
request.AddHeader("x-appwrite-jwt", "{{apiKey}}");
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/avatars/image?url="
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-appwrite-jwt", "{{apiKey}}")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/avatars/image?url= HTTP/1.1
X-Appwrite-Jwt: {{apiKey}}
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/avatars/image?url=")
.setHeader("x-appwrite-jwt", "{{apiKey}}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/avatars/image?url="))
.header("x-appwrite-jwt", "{{apiKey}}")
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/avatars/image?url=")
.get()
.addHeader("x-appwrite-jwt", "{{apiKey}}")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/avatars/image?url=")
.header("x-appwrite-jwt", "{{apiKey}}")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/avatars/image?url=');
xhr.setRequestHeader('x-appwrite-jwt', '{{apiKey}}');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/avatars/image',
params: {url: ''},
headers: {'x-appwrite-jwt': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/avatars/image?url=';
const options = {method: 'GET', headers: {'x-appwrite-jwt': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/avatars/image?url=',
method: 'GET',
headers: {
'x-appwrite-jwt': '{{apiKey}}'
}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/avatars/image?url=")
.get()
.addHeader("x-appwrite-jwt", "{{apiKey}}")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/avatars/image?url=',
headers: {
'x-appwrite-jwt': '{{apiKey}}'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/avatars/image',
qs: {url: ''},
headers: {'x-appwrite-jwt': '{{apiKey}}'}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/avatars/image');
req.query({
url: ''
});
req.headers({
'x-appwrite-jwt': '{{apiKey}}'
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/avatars/image',
params: {url: ''},
headers: {'x-appwrite-jwt': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/avatars/image?url=';
const options = {method: 'GET', headers: {'x-appwrite-jwt': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-appwrite-jwt": @"{{apiKey}}" };
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/avatars/image?url="]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
[request setAllHTTPHeaderFields:headers];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/avatars/image?url=" in
let headers = Header.add (Header.init ()) "x-appwrite-jwt" "{{apiKey}}" in
Client.call ~headers `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/avatars/image?url=",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-appwrite-jwt: {{apiKey}}"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/avatars/image?url=', [
'headers' => [
'x-appwrite-jwt' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/avatars/image');
$request->setMethod(HTTP_METH_GET);
$request->setQueryData([
'url' => ''
]);
$request->setHeaders([
'x-appwrite-jwt' => '{{apiKey}}'
]);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/avatars/image');
$request->setRequestMethod('GET');
$request->setQuery(new http\QueryString([
'url' => ''
]));
$request->setHeaders([
'x-appwrite-jwt' => '{{apiKey}}'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-appwrite-jwt", "{{apiKey}}")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/avatars/image?url=' -Method GET -Headers $headers
$headers=@{}
$headers.Add("x-appwrite-jwt", "{{apiKey}}")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/avatars/image?url=' -Method GET -Headers $headers
import http.client
conn = http.client.HTTPSConnection("example.com")
headers = { 'x-appwrite-jwt': "{{apiKey}}" }
conn.request("GET", "/baseUrl/avatars/image?url=", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/avatars/image"
querystring = {"url":""}
headers = {"x-appwrite-jwt": "{{apiKey}}"}
response = requests.get(url, headers=headers, params=querystring)
print(response.json())
library(httr)
url <- "{{baseUrl}}/avatars/image"
queryString <- list(url = "")
response <- VERB("GET", url, query = queryString, add_headers('x-appwrite-jwt' = '{{apiKey}}'), content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/avatars/image?url=")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-appwrite-jwt"] = '{{apiKey}}'
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/avatars/image') do |req|
req.headers['x-appwrite-jwt'] = '{{apiKey}}'
req.params['url'] = ''
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/avatars/image";
let querystring = [
("url", ""),
];
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-appwrite-jwt", "{{apiKey}}".parse().unwrap());
let client = reqwest::Client::new();
let response = client.get(url)
.query(&querystring)
.headers(headers)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url '{{baseUrl}}/avatars/image?url=' \
--header 'x-appwrite-jwt: {{apiKey}}'
http GET '{{baseUrl}}/avatars/image?url=' \
x-appwrite-jwt:'{{apiKey}}'
wget --quiet \
--method GET \
--header 'x-appwrite-jwt: {{apiKey}}' \
--output-document \
- '{{baseUrl}}/avatars/image?url='
import Foundation
let headers = ["x-appwrite-jwt": "{{apiKey}}"]
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/avatars/image?url=")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
Get QR Code
{{baseUrl}}/avatars/qr
HEADERS
X-Appwrite-JWT
{{apiKey}}
QUERY PARAMS
text
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/avatars/qr?text=");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-appwrite-jwt: {{apiKey}}");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/avatars/qr" {:headers {:x-appwrite-jwt "{{apiKey}}"}
:query-params {:text ""}})
require "http/client"
url = "{{baseUrl}}/avatars/qr?text="
headers = HTTP::Headers{
"x-appwrite-jwt" => "{{apiKey}}"
}
response = HTTP::Client.get url, headers: headers
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/avatars/qr?text="),
Headers =
{
{ "x-appwrite-jwt", "{{apiKey}}" },
},
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/avatars/qr?text=");
var request = new RestRequest("", Method.Get);
request.AddHeader("x-appwrite-jwt", "{{apiKey}}");
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/avatars/qr?text="
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-appwrite-jwt", "{{apiKey}}")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/avatars/qr?text= HTTP/1.1
X-Appwrite-Jwt: {{apiKey}}
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/avatars/qr?text=")
.setHeader("x-appwrite-jwt", "{{apiKey}}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/avatars/qr?text="))
.header("x-appwrite-jwt", "{{apiKey}}")
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/avatars/qr?text=")
.get()
.addHeader("x-appwrite-jwt", "{{apiKey}}")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/avatars/qr?text=")
.header("x-appwrite-jwt", "{{apiKey}}")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/avatars/qr?text=');
xhr.setRequestHeader('x-appwrite-jwt', '{{apiKey}}');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/avatars/qr',
params: {text: ''},
headers: {'x-appwrite-jwt': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/avatars/qr?text=';
const options = {method: 'GET', headers: {'x-appwrite-jwt': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/avatars/qr?text=',
method: 'GET',
headers: {
'x-appwrite-jwt': '{{apiKey}}'
}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/avatars/qr?text=")
.get()
.addHeader("x-appwrite-jwt", "{{apiKey}}")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/avatars/qr?text=',
headers: {
'x-appwrite-jwt': '{{apiKey}}'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/avatars/qr',
qs: {text: ''},
headers: {'x-appwrite-jwt': '{{apiKey}}'}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/avatars/qr');
req.query({
text: ''
});
req.headers({
'x-appwrite-jwt': '{{apiKey}}'
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/avatars/qr',
params: {text: ''},
headers: {'x-appwrite-jwt': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/avatars/qr?text=';
const options = {method: 'GET', headers: {'x-appwrite-jwt': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-appwrite-jwt": @"{{apiKey}}" };
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/avatars/qr?text="]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
[request setAllHTTPHeaderFields:headers];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/avatars/qr?text=" in
let headers = Header.add (Header.init ()) "x-appwrite-jwt" "{{apiKey}}" in
Client.call ~headers `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/avatars/qr?text=",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-appwrite-jwt: {{apiKey}}"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/avatars/qr?text=', [
'headers' => [
'x-appwrite-jwt' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/avatars/qr');
$request->setMethod(HTTP_METH_GET);
$request->setQueryData([
'text' => ''
]);
$request->setHeaders([
'x-appwrite-jwt' => '{{apiKey}}'
]);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/avatars/qr');
$request->setRequestMethod('GET');
$request->setQuery(new http\QueryString([
'text' => ''
]));
$request->setHeaders([
'x-appwrite-jwt' => '{{apiKey}}'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-appwrite-jwt", "{{apiKey}}")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/avatars/qr?text=' -Method GET -Headers $headers
$headers=@{}
$headers.Add("x-appwrite-jwt", "{{apiKey}}")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/avatars/qr?text=' -Method GET -Headers $headers
import http.client
conn = http.client.HTTPSConnection("example.com")
headers = { 'x-appwrite-jwt': "{{apiKey}}" }
conn.request("GET", "/baseUrl/avatars/qr?text=", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/avatars/qr"
querystring = {"text":""}
headers = {"x-appwrite-jwt": "{{apiKey}}"}
response = requests.get(url, headers=headers, params=querystring)
print(response.json())
library(httr)
url <- "{{baseUrl}}/avatars/qr"
queryString <- list(text = "")
response <- VERB("GET", url, query = queryString, add_headers('x-appwrite-jwt' = '{{apiKey}}'), content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/avatars/qr?text=")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-appwrite-jwt"] = '{{apiKey}}'
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/avatars/qr') do |req|
req.headers['x-appwrite-jwt'] = '{{apiKey}}'
req.params['text'] = ''
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/avatars/qr";
let querystring = [
("text", ""),
];
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-appwrite-jwt", "{{apiKey}}".parse().unwrap());
let client = reqwest::Client::new();
let response = client.get(url)
.query(&querystring)
.headers(headers)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url '{{baseUrl}}/avatars/qr?text=' \
--header 'x-appwrite-jwt: {{apiKey}}'
http GET '{{baseUrl}}/avatars/qr?text=' \
x-appwrite-jwt:'{{apiKey}}'
wget --quiet \
--method GET \
--header 'x-appwrite-jwt: {{apiKey}}' \
--output-document \
- '{{baseUrl}}/avatars/qr?text='
import Foundation
let headers = ["x-appwrite-jwt": "{{apiKey}}"]
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/avatars/qr?text=")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
Get User Initials
{{baseUrl}}/avatars/initials
HEADERS
X-Appwrite-JWT
{{apiKey}}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/avatars/initials");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-appwrite-jwt: {{apiKey}}");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/avatars/initials" {:headers {:x-appwrite-jwt "{{apiKey}}"}})
require "http/client"
url = "{{baseUrl}}/avatars/initials"
headers = HTTP::Headers{
"x-appwrite-jwt" => "{{apiKey}}"
}
response = HTTP::Client.get url, headers: headers
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/avatars/initials"),
Headers =
{
{ "x-appwrite-jwt", "{{apiKey}}" },
},
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/avatars/initials");
var request = new RestRequest("", Method.Get);
request.AddHeader("x-appwrite-jwt", "{{apiKey}}");
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/avatars/initials"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-appwrite-jwt", "{{apiKey}}")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/avatars/initials HTTP/1.1
X-Appwrite-Jwt: {{apiKey}}
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/avatars/initials")
.setHeader("x-appwrite-jwt", "{{apiKey}}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/avatars/initials"))
.header("x-appwrite-jwt", "{{apiKey}}")
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/avatars/initials")
.get()
.addHeader("x-appwrite-jwt", "{{apiKey}}")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/avatars/initials")
.header("x-appwrite-jwt", "{{apiKey}}")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/avatars/initials');
xhr.setRequestHeader('x-appwrite-jwt', '{{apiKey}}');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/avatars/initials',
headers: {'x-appwrite-jwt': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/avatars/initials';
const options = {method: 'GET', headers: {'x-appwrite-jwt': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/avatars/initials',
method: 'GET',
headers: {
'x-appwrite-jwt': '{{apiKey}}'
}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/avatars/initials")
.get()
.addHeader("x-appwrite-jwt", "{{apiKey}}")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/avatars/initials',
headers: {
'x-appwrite-jwt': '{{apiKey}}'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/avatars/initials',
headers: {'x-appwrite-jwt': '{{apiKey}}'}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/avatars/initials');
req.headers({
'x-appwrite-jwt': '{{apiKey}}'
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/avatars/initials',
headers: {'x-appwrite-jwt': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/avatars/initials';
const options = {method: 'GET', headers: {'x-appwrite-jwt': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-appwrite-jwt": @"{{apiKey}}" };
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/avatars/initials"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
[request setAllHTTPHeaderFields:headers];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/avatars/initials" in
let headers = Header.add (Header.init ()) "x-appwrite-jwt" "{{apiKey}}" in
Client.call ~headers `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/avatars/initials",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-appwrite-jwt: {{apiKey}}"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/avatars/initials', [
'headers' => [
'x-appwrite-jwt' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/avatars/initials');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders([
'x-appwrite-jwt' => '{{apiKey}}'
]);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/avatars/initials');
$request->setRequestMethod('GET');
$request->setHeaders([
'x-appwrite-jwt' => '{{apiKey}}'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-appwrite-jwt", "{{apiKey}}")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/avatars/initials' -Method GET -Headers $headers
$headers=@{}
$headers.Add("x-appwrite-jwt", "{{apiKey}}")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/avatars/initials' -Method GET -Headers $headers
import http.client
conn = http.client.HTTPSConnection("example.com")
headers = { 'x-appwrite-jwt': "{{apiKey}}" }
conn.request("GET", "/baseUrl/avatars/initials", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/avatars/initials"
headers = {"x-appwrite-jwt": "{{apiKey}}"}
response = requests.get(url, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/avatars/initials"
response <- VERB("GET", url, add_headers('x-appwrite-jwt' = '{{apiKey}}'), content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/avatars/initials")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-appwrite-jwt"] = '{{apiKey}}'
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/avatars/initials') do |req|
req.headers['x-appwrite-jwt'] = '{{apiKey}}'
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/avatars/initials";
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-appwrite-jwt", "{{apiKey}}".parse().unwrap());
let client = reqwest::Client::new();
let response = client.get(url)
.headers(headers)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/avatars/initials \
--header 'x-appwrite-jwt: {{apiKey}}'
http GET {{baseUrl}}/avatars/initials \
x-appwrite-jwt:'{{apiKey}}'
wget --quiet \
--method GET \
--header 'x-appwrite-jwt: {{apiKey}}' \
--output-document \
- {{baseUrl}}/avatars/initials
import Foundation
let headers = ["x-appwrite-jwt": "{{apiKey}}"]
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/avatars/initials")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
Create Document
{{baseUrl}}/database/collections/:collectionId/documents
HEADERS
X-Appwrite-JWT
{{apiKey}}
QUERY PARAMS
collectionId
BODY json
{
"data": {},
"parentDocument": "",
"parentProperty": "",
"parentPropertyType": "",
"read": [],
"write": []
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/database/collections/:collectionId/documents");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-appwrite-jwt: {{apiKey}}");
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"data\": {},\n \"parentDocument\": \"\",\n \"parentProperty\": \"\",\n \"parentPropertyType\": \"\",\n \"read\": [],\n \"write\": []\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/database/collections/:collectionId/documents" {:headers {:x-appwrite-jwt "{{apiKey}}"}
:content-type :json
:form-params {:data {}
:parentDocument ""
:parentProperty ""
:parentPropertyType ""
:read []
:write []}})
require "http/client"
url = "{{baseUrl}}/database/collections/:collectionId/documents"
headers = HTTP::Headers{
"x-appwrite-jwt" => "{{apiKey}}"
"content-type" => "application/json"
}
reqBody = "{\n \"data\": {},\n \"parentDocument\": \"\",\n \"parentProperty\": \"\",\n \"parentPropertyType\": \"\",\n \"read\": [],\n \"write\": []\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/database/collections/:collectionId/documents"),
Headers =
{
{ "x-appwrite-jwt", "{{apiKey}}" },
},
Content = new StringContent("{\n \"data\": {},\n \"parentDocument\": \"\",\n \"parentProperty\": \"\",\n \"parentPropertyType\": \"\",\n \"read\": [],\n \"write\": []\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/database/collections/:collectionId/documents");
var request = new RestRequest("", Method.Post);
request.AddHeader("x-appwrite-jwt", "{{apiKey}}");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"data\": {},\n \"parentDocument\": \"\",\n \"parentProperty\": \"\",\n \"parentPropertyType\": \"\",\n \"read\": [],\n \"write\": []\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/database/collections/:collectionId/documents"
payload := strings.NewReader("{\n \"data\": {},\n \"parentDocument\": \"\",\n \"parentProperty\": \"\",\n \"parentPropertyType\": \"\",\n \"read\": [],\n \"write\": []\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-appwrite-jwt", "{{apiKey}}")
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/database/collections/:collectionId/documents HTTP/1.1
X-Appwrite-Jwt: {{apiKey}}
Content-Type: application/json
Host: example.com
Content-Length: 121
{
"data": {},
"parentDocument": "",
"parentProperty": "",
"parentPropertyType": "",
"read": [],
"write": []
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/database/collections/:collectionId/documents")
.setHeader("x-appwrite-jwt", "{{apiKey}}")
.setHeader("content-type", "application/json")
.setBody("{\n \"data\": {},\n \"parentDocument\": \"\",\n \"parentProperty\": \"\",\n \"parentPropertyType\": \"\",\n \"read\": [],\n \"write\": []\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/database/collections/:collectionId/documents"))
.header("x-appwrite-jwt", "{{apiKey}}")
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"data\": {},\n \"parentDocument\": \"\",\n \"parentProperty\": \"\",\n \"parentPropertyType\": \"\",\n \"read\": [],\n \"write\": []\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"data\": {},\n \"parentDocument\": \"\",\n \"parentProperty\": \"\",\n \"parentPropertyType\": \"\",\n \"read\": [],\n \"write\": []\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/database/collections/:collectionId/documents")
.post(body)
.addHeader("x-appwrite-jwt", "{{apiKey}}")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/database/collections/:collectionId/documents")
.header("x-appwrite-jwt", "{{apiKey}}")
.header("content-type", "application/json")
.body("{\n \"data\": {},\n \"parentDocument\": \"\",\n \"parentProperty\": \"\",\n \"parentPropertyType\": \"\",\n \"read\": [],\n \"write\": []\n}")
.asString();
const data = JSON.stringify({
data: {},
parentDocument: '',
parentProperty: '',
parentPropertyType: '',
read: [],
write: []
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/database/collections/:collectionId/documents');
xhr.setRequestHeader('x-appwrite-jwt', '{{apiKey}}');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/database/collections/:collectionId/documents',
headers: {'x-appwrite-jwt': '{{apiKey}}', 'content-type': 'application/json'},
data: {
data: {},
parentDocument: '',
parentProperty: '',
parentPropertyType: '',
read: [],
write: []
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/database/collections/:collectionId/documents';
const options = {
method: 'POST',
headers: {'x-appwrite-jwt': '{{apiKey}}', 'content-type': 'application/json'},
body: '{"data":{},"parentDocument":"","parentProperty":"","parentPropertyType":"","read":[],"write":[]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/database/collections/:collectionId/documents',
method: 'POST',
headers: {
'x-appwrite-jwt': '{{apiKey}}',
'content-type': 'application/json'
},
processData: false,
data: '{\n "data": {},\n "parentDocument": "",\n "parentProperty": "",\n "parentPropertyType": "",\n "read": [],\n "write": []\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"data\": {},\n \"parentDocument\": \"\",\n \"parentProperty\": \"\",\n \"parentPropertyType\": \"\",\n \"read\": [],\n \"write\": []\n}")
val request = Request.Builder()
.url("{{baseUrl}}/database/collections/:collectionId/documents")
.post(body)
.addHeader("x-appwrite-jwt", "{{apiKey}}")
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/database/collections/:collectionId/documents',
headers: {
'x-appwrite-jwt': '{{apiKey}}',
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({
data: {},
parentDocument: '',
parentProperty: '',
parentPropertyType: '',
read: [],
write: []
}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/database/collections/:collectionId/documents',
headers: {'x-appwrite-jwt': '{{apiKey}}', 'content-type': 'application/json'},
body: {
data: {},
parentDocument: '',
parentProperty: '',
parentPropertyType: '',
read: [],
write: []
},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/database/collections/:collectionId/documents');
req.headers({
'x-appwrite-jwt': '{{apiKey}}',
'content-type': 'application/json'
});
req.type('json');
req.send({
data: {},
parentDocument: '',
parentProperty: '',
parentPropertyType: '',
read: [],
write: []
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/database/collections/:collectionId/documents',
headers: {'x-appwrite-jwt': '{{apiKey}}', 'content-type': 'application/json'},
data: {
data: {},
parentDocument: '',
parentProperty: '',
parentPropertyType: '',
read: [],
write: []
}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/database/collections/:collectionId/documents';
const options = {
method: 'POST',
headers: {'x-appwrite-jwt': '{{apiKey}}', 'content-type': 'application/json'},
body: '{"data":{},"parentDocument":"","parentProperty":"","parentPropertyType":"","read":[],"write":[]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-appwrite-jwt": @"{{apiKey}}",
@"content-type": @"application/json" };
NSDictionary *parameters = @{ @"data": @{ },
@"parentDocument": @"",
@"parentProperty": @"",
@"parentPropertyType": @"",
@"read": @[ ],
@"write": @[ ] };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/database/collections/:collectionId/documents"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/database/collections/:collectionId/documents" in
let headers = Header.add_list (Header.init ()) [
("x-appwrite-jwt", "{{apiKey}}");
("content-type", "application/json");
] in
let body = Cohttp_lwt_body.of_string "{\n \"data\": {},\n \"parentDocument\": \"\",\n \"parentProperty\": \"\",\n \"parentPropertyType\": \"\",\n \"read\": [],\n \"write\": []\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/database/collections/:collectionId/documents",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'data' => [
],
'parentDocument' => '',
'parentProperty' => '',
'parentPropertyType' => '',
'read' => [
],
'write' => [
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json",
"x-appwrite-jwt: {{apiKey}}"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/database/collections/:collectionId/documents', [
'body' => '{
"data": {},
"parentDocument": "",
"parentProperty": "",
"parentPropertyType": "",
"read": [],
"write": []
}',
'headers' => [
'content-type' => 'application/json',
'x-appwrite-jwt' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/database/collections/:collectionId/documents');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'x-appwrite-jwt' => '{{apiKey}}',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'data' => [
],
'parentDocument' => '',
'parentProperty' => '',
'parentPropertyType' => '',
'read' => [
],
'write' => [
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'data' => [
],
'parentDocument' => '',
'parentProperty' => '',
'parentPropertyType' => '',
'read' => [
],
'write' => [
]
]));
$request->setRequestUrl('{{baseUrl}}/database/collections/:collectionId/documents');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'x-appwrite-jwt' => '{{apiKey}}',
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-appwrite-jwt", "{{apiKey}}")
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/database/collections/:collectionId/documents' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"data": {},
"parentDocument": "",
"parentProperty": "",
"parentPropertyType": "",
"read": [],
"write": []
}'
$headers=@{}
$headers.Add("x-appwrite-jwt", "{{apiKey}}")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/database/collections/:collectionId/documents' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"data": {},
"parentDocument": "",
"parentProperty": "",
"parentPropertyType": "",
"read": [],
"write": []
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"data\": {},\n \"parentDocument\": \"\",\n \"parentProperty\": \"\",\n \"parentPropertyType\": \"\",\n \"read\": [],\n \"write\": []\n}"
headers = {
'x-appwrite-jwt': "{{apiKey}}",
'content-type': "application/json"
}
conn.request("POST", "/baseUrl/database/collections/:collectionId/documents", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/database/collections/:collectionId/documents"
payload = {
"data": {},
"parentDocument": "",
"parentProperty": "",
"parentPropertyType": "",
"read": [],
"write": []
}
headers = {
"x-appwrite-jwt": "{{apiKey}}",
"content-type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/database/collections/:collectionId/documents"
payload <- "{\n \"data\": {},\n \"parentDocument\": \"\",\n \"parentProperty\": \"\",\n \"parentPropertyType\": \"\",\n \"read\": [],\n \"write\": []\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, add_headers('x-appwrite-jwt' = '{{apiKey}}'), content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/database/collections/:collectionId/documents")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-appwrite-jwt"] = '{{apiKey}}'
request["content-type"] = 'application/json'
request.body = "{\n \"data\": {},\n \"parentDocument\": \"\",\n \"parentProperty\": \"\",\n \"parentPropertyType\": \"\",\n \"read\": [],\n \"write\": []\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/database/collections/:collectionId/documents') do |req|
req.headers['x-appwrite-jwt'] = '{{apiKey}}'
req.body = "{\n \"data\": {},\n \"parentDocument\": \"\",\n \"parentProperty\": \"\",\n \"parentPropertyType\": \"\",\n \"read\": [],\n \"write\": []\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/database/collections/:collectionId/documents";
let payload = json!({
"data": json!({}),
"parentDocument": "",
"parentProperty": "",
"parentPropertyType": "",
"read": (),
"write": ()
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-appwrite-jwt", "{{apiKey}}".parse().unwrap());
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/database/collections/:collectionId/documents \
--header 'content-type: application/json' \
--header 'x-appwrite-jwt: {{apiKey}}' \
--data '{
"data": {},
"parentDocument": "",
"parentProperty": "",
"parentPropertyType": "",
"read": [],
"write": []
}'
echo '{
"data": {},
"parentDocument": "",
"parentProperty": "",
"parentPropertyType": "",
"read": [],
"write": []
}' | \
http POST {{baseUrl}}/database/collections/:collectionId/documents \
content-type:application/json \
x-appwrite-jwt:'{{apiKey}}'
wget --quiet \
--method POST \
--header 'x-appwrite-jwt: {{apiKey}}' \
--header 'content-type: application/json' \
--body-data '{\n "data": {},\n "parentDocument": "",\n "parentProperty": "",\n "parentPropertyType": "",\n "read": [],\n "write": []\n}' \
--output-document \
- {{baseUrl}}/database/collections/:collectionId/documents
import Foundation
let headers = [
"x-appwrite-jwt": "{{apiKey}}",
"content-type": "application/json"
]
let parameters = [
"data": [],
"parentDocument": "",
"parentProperty": "",
"parentPropertyType": "",
"read": [],
"write": []
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/database/collections/:collectionId/documents")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
DELETE
Delete Document
{{baseUrl}}/database/collections/:collectionId/documents/:documentId
HEADERS
X-Appwrite-JWT
{{apiKey}}
QUERY PARAMS
collectionId
documentId
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/database/collections/:collectionId/documents/:documentId");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-appwrite-jwt: {{apiKey}}");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/database/collections/:collectionId/documents/:documentId" {:headers {:x-appwrite-jwt "{{apiKey}}"}})
require "http/client"
url = "{{baseUrl}}/database/collections/:collectionId/documents/:documentId"
headers = HTTP::Headers{
"x-appwrite-jwt" => "{{apiKey}}"
}
response = HTTP::Client.delete url, headers: headers
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Delete,
RequestUri = new Uri("{{baseUrl}}/database/collections/:collectionId/documents/:documentId"),
Headers =
{
{ "x-appwrite-jwt", "{{apiKey}}" },
},
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/database/collections/:collectionId/documents/:documentId");
var request = new RestRequest("", Method.Delete);
request.AddHeader("x-appwrite-jwt", "{{apiKey}}");
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/database/collections/:collectionId/documents/:documentId"
req, _ := http.NewRequest("DELETE", url, nil)
req.Header.Add("x-appwrite-jwt", "{{apiKey}}")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
DELETE /baseUrl/database/collections/:collectionId/documents/:documentId HTTP/1.1
X-Appwrite-Jwt: {{apiKey}}
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/database/collections/:collectionId/documents/:documentId")
.setHeader("x-appwrite-jwt", "{{apiKey}}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/database/collections/:collectionId/documents/:documentId"))
.header("x-appwrite-jwt", "{{apiKey}}")
.method("DELETE", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/database/collections/:collectionId/documents/:documentId")
.delete(null)
.addHeader("x-appwrite-jwt", "{{apiKey}}")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/database/collections/:collectionId/documents/:documentId")
.header("x-appwrite-jwt", "{{apiKey}}")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('DELETE', '{{baseUrl}}/database/collections/:collectionId/documents/:documentId');
xhr.setRequestHeader('x-appwrite-jwt', '{{apiKey}}');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'DELETE',
url: '{{baseUrl}}/database/collections/:collectionId/documents/:documentId',
headers: {'x-appwrite-jwt': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/database/collections/:collectionId/documents/:documentId';
const options = {method: 'DELETE', headers: {'x-appwrite-jwt': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/database/collections/:collectionId/documents/:documentId',
method: 'DELETE',
headers: {
'x-appwrite-jwt': '{{apiKey}}'
}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/database/collections/:collectionId/documents/:documentId")
.delete(null)
.addHeader("x-appwrite-jwt", "{{apiKey}}")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'DELETE',
hostname: 'example.com',
port: null,
path: '/baseUrl/database/collections/:collectionId/documents/:documentId',
headers: {
'x-appwrite-jwt': '{{apiKey}}'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'DELETE',
url: '{{baseUrl}}/database/collections/:collectionId/documents/:documentId',
headers: {'x-appwrite-jwt': '{{apiKey}}'}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('DELETE', '{{baseUrl}}/database/collections/:collectionId/documents/:documentId');
req.headers({
'x-appwrite-jwt': '{{apiKey}}'
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'DELETE',
url: '{{baseUrl}}/database/collections/:collectionId/documents/:documentId',
headers: {'x-appwrite-jwt': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/database/collections/:collectionId/documents/:documentId';
const options = {method: 'DELETE', headers: {'x-appwrite-jwt': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-appwrite-jwt": @"{{apiKey}}" };
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/database/collections/:collectionId/documents/:documentId"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"DELETE"];
[request setAllHTTPHeaderFields:headers];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/database/collections/:collectionId/documents/:documentId" in
let headers = Header.add (Header.init ()) "x-appwrite-jwt" "{{apiKey}}" in
Client.call ~headers `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/database/collections/:collectionId/documents/:documentId",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_HTTPHEADER => [
"x-appwrite-jwt: {{apiKey}}"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('DELETE', '{{baseUrl}}/database/collections/:collectionId/documents/:documentId', [
'headers' => [
'x-appwrite-jwt' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/database/collections/:collectionId/documents/:documentId');
$request->setMethod(HTTP_METH_DELETE);
$request->setHeaders([
'x-appwrite-jwt' => '{{apiKey}}'
]);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/database/collections/:collectionId/documents/:documentId');
$request->setRequestMethod('DELETE');
$request->setHeaders([
'x-appwrite-jwt' => '{{apiKey}}'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-appwrite-jwt", "{{apiKey}}")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/database/collections/:collectionId/documents/:documentId' -Method DELETE -Headers $headers
$headers=@{}
$headers.Add("x-appwrite-jwt", "{{apiKey}}")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/database/collections/:collectionId/documents/:documentId' -Method DELETE -Headers $headers
import http.client
conn = http.client.HTTPSConnection("example.com")
headers = { 'x-appwrite-jwt': "{{apiKey}}" }
conn.request("DELETE", "/baseUrl/database/collections/:collectionId/documents/:documentId", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/database/collections/:collectionId/documents/:documentId"
headers = {"x-appwrite-jwt": "{{apiKey}}"}
response = requests.delete(url, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/database/collections/:collectionId/documents/:documentId"
response <- VERB("DELETE", url, add_headers('x-appwrite-jwt' = '{{apiKey}}'), content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/database/collections/:collectionId/documents/:documentId")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["x-appwrite-jwt"] = '{{apiKey}}'
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.delete('/baseUrl/database/collections/:collectionId/documents/:documentId') do |req|
req.headers['x-appwrite-jwt'] = '{{apiKey}}'
end
puts response.status
puts response.body
use std::str::FromStr;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/database/collections/:collectionId/documents/:documentId";
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-appwrite-jwt", "{{apiKey}}".parse().unwrap());
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("DELETE").unwrap(), url)
.headers(headers)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request DELETE \
--url {{baseUrl}}/database/collections/:collectionId/documents/:documentId \
--header 'x-appwrite-jwt: {{apiKey}}'
http DELETE {{baseUrl}}/database/collections/:collectionId/documents/:documentId \
x-appwrite-jwt:'{{apiKey}}'
wget --quiet \
--method DELETE \
--header 'x-appwrite-jwt: {{apiKey}}' \
--output-document \
- {{baseUrl}}/database/collections/:collectionId/documents/:documentId
import Foundation
let headers = ["x-appwrite-jwt": "{{apiKey}}"]
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/database/collections/:collectionId/documents/:documentId")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "DELETE"
request.allHTTPHeaderFields = headers
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
Get Document
{{baseUrl}}/database/collections/:collectionId/documents/:documentId
HEADERS
X-Appwrite-JWT
{{apiKey}}
QUERY PARAMS
collectionId
documentId
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/database/collections/:collectionId/documents/:documentId");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-appwrite-jwt: {{apiKey}}");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/database/collections/:collectionId/documents/:documentId" {:headers {:x-appwrite-jwt "{{apiKey}}"}})
require "http/client"
url = "{{baseUrl}}/database/collections/:collectionId/documents/:documentId"
headers = HTTP::Headers{
"x-appwrite-jwt" => "{{apiKey}}"
}
response = HTTP::Client.get url, headers: headers
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/database/collections/:collectionId/documents/:documentId"),
Headers =
{
{ "x-appwrite-jwt", "{{apiKey}}" },
},
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/database/collections/:collectionId/documents/:documentId");
var request = new RestRequest("", Method.Get);
request.AddHeader("x-appwrite-jwt", "{{apiKey}}");
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/database/collections/:collectionId/documents/:documentId"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-appwrite-jwt", "{{apiKey}}")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/database/collections/:collectionId/documents/:documentId HTTP/1.1
X-Appwrite-Jwt: {{apiKey}}
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/database/collections/:collectionId/documents/:documentId")
.setHeader("x-appwrite-jwt", "{{apiKey}}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/database/collections/:collectionId/documents/:documentId"))
.header("x-appwrite-jwt", "{{apiKey}}")
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/database/collections/:collectionId/documents/:documentId")
.get()
.addHeader("x-appwrite-jwt", "{{apiKey}}")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/database/collections/:collectionId/documents/:documentId")
.header("x-appwrite-jwt", "{{apiKey}}")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/database/collections/:collectionId/documents/:documentId');
xhr.setRequestHeader('x-appwrite-jwt', '{{apiKey}}');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/database/collections/:collectionId/documents/:documentId',
headers: {'x-appwrite-jwt': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/database/collections/:collectionId/documents/:documentId';
const options = {method: 'GET', headers: {'x-appwrite-jwt': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/database/collections/:collectionId/documents/:documentId',
method: 'GET',
headers: {
'x-appwrite-jwt': '{{apiKey}}'
}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/database/collections/:collectionId/documents/:documentId")
.get()
.addHeader("x-appwrite-jwt", "{{apiKey}}")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/database/collections/:collectionId/documents/:documentId',
headers: {
'x-appwrite-jwt': '{{apiKey}}'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/database/collections/:collectionId/documents/:documentId',
headers: {'x-appwrite-jwt': '{{apiKey}}'}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/database/collections/:collectionId/documents/:documentId');
req.headers({
'x-appwrite-jwt': '{{apiKey}}'
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/database/collections/:collectionId/documents/:documentId',
headers: {'x-appwrite-jwt': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/database/collections/:collectionId/documents/:documentId';
const options = {method: 'GET', headers: {'x-appwrite-jwt': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-appwrite-jwt": @"{{apiKey}}" };
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/database/collections/:collectionId/documents/:documentId"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
[request setAllHTTPHeaderFields:headers];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/database/collections/:collectionId/documents/:documentId" in
let headers = Header.add (Header.init ()) "x-appwrite-jwt" "{{apiKey}}" in
Client.call ~headers `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/database/collections/:collectionId/documents/:documentId",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-appwrite-jwt: {{apiKey}}"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/database/collections/:collectionId/documents/:documentId', [
'headers' => [
'x-appwrite-jwt' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/database/collections/:collectionId/documents/:documentId');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders([
'x-appwrite-jwt' => '{{apiKey}}'
]);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/database/collections/:collectionId/documents/:documentId');
$request->setRequestMethod('GET');
$request->setHeaders([
'x-appwrite-jwt' => '{{apiKey}}'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-appwrite-jwt", "{{apiKey}}")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/database/collections/:collectionId/documents/:documentId' -Method GET -Headers $headers
$headers=@{}
$headers.Add("x-appwrite-jwt", "{{apiKey}}")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/database/collections/:collectionId/documents/:documentId' -Method GET -Headers $headers
import http.client
conn = http.client.HTTPSConnection("example.com")
headers = { 'x-appwrite-jwt': "{{apiKey}}" }
conn.request("GET", "/baseUrl/database/collections/:collectionId/documents/:documentId", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/database/collections/:collectionId/documents/:documentId"
headers = {"x-appwrite-jwt": "{{apiKey}}"}
response = requests.get(url, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/database/collections/:collectionId/documents/:documentId"
response <- VERB("GET", url, add_headers('x-appwrite-jwt' = '{{apiKey}}'), content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/database/collections/:collectionId/documents/:documentId")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-appwrite-jwt"] = '{{apiKey}}'
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/database/collections/:collectionId/documents/:documentId') do |req|
req.headers['x-appwrite-jwt'] = '{{apiKey}}'
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/database/collections/:collectionId/documents/:documentId";
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-appwrite-jwt", "{{apiKey}}".parse().unwrap());
let client = reqwest::Client::new();
let response = client.get(url)
.headers(headers)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/database/collections/:collectionId/documents/:documentId \
--header 'x-appwrite-jwt: {{apiKey}}'
http GET {{baseUrl}}/database/collections/:collectionId/documents/:documentId \
x-appwrite-jwt:'{{apiKey}}'
wget --quiet \
--method GET \
--header 'x-appwrite-jwt: {{apiKey}}' \
--output-document \
- {{baseUrl}}/database/collections/:collectionId/documents/:documentId
import Foundation
let headers = ["x-appwrite-jwt": "{{apiKey}}"]
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/database/collections/:collectionId/documents/:documentId")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
List Documents
{{baseUrl}}/database/collections/:collectionId/documents
HEADERS
X-Appwrite-JWT
{{apiKey}}
QUERY PARAMS
collectionId
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/database/collections/:collectionId/documents");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-appwrite-jwt: {{apiKey}}");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/database/collections/:collectionId/documents" {:headers {:x-appwrite-jwt "{{apiKey}}"}})
require "http/client"
url = "{{baseUrl}}/database/collections/:collectionId/documents"
headers = HTTP::Headers{
"x-appwrite-jwt" => "{{apiKey}}"
}
response = HTTP::Client.get url, headers: headers
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/database/collections/:collectionId/documents"),
Headers =
{
{ "x-appwrite-jwt", "{{apiKey}}" },
},
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/database/collections/:collectionId/documents");
var request = new RestRequest("", Method.Get);
request.AddHeader("x-appwrite-jwt", "{{apiKey}}");
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/database/collections/:collectionId/documents"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-appwrite-jwt", "{{apiKey}}")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/database/collections/:collectionId/documents HTTP/1.1
X-Appwrite-Jwt: {{apiKey}}
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/database/collections/:collectionId/documents")
.setHeader("x-appwrite-jwt", "{{apiKey}}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/database/collections/:collectionId/documents"))
.header("x-appwrite-jwt", "{{apiKey}}")
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/database/collections/:collectionId/documents")
.get()
.addHeader("x-appwrite-jwt", "{{apiKey}}")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/database/collections/:collectionId/documents")
.header("x-appwrite-jwt", "{{apiKey}}")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/database/collections/:collectionId/documents');
xhr.setRequestHeader('x-appwrite-jwt', '{{apiKey}}');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/database/collections/:collectionId/documents',
headers: {'x-appwrite-jwt': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/database/collections/:collectionId/documents';
const options = {method: 'GET', headers: {'x-appwrite-jwt': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/database/collections/:collectionId/documents',
method: 'GET',
headers: {
'x-appwrite-jwt': '{{apiKey}}'
}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/database/collections/:collectionId/documents")
.get()
.addHeader("x-appwrite-jwt", "{{apiKey}}")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/database/collections/:collectionId/documents',
headers: {
'x-appwrite-jwt': '{{apiKey}}'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/database/collections/:collectionId/documents',
headers: {'x-appwrite-jwt': '{{apiKey}}'}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/database/collections/:collectionId/documents');
req.headers({
'x-appwrite-jwt': '{{apiKey}}'
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/database/collections/:collectionId/documents',
headers: {'x-appwrite-jwt': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/database/collections/:collectionId/documents';
const options = {method: 'GET', headers: {'x-appwrite-jwt': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-appwrite-jwt": @"{{apiKey}}" };
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/database/collections/:collectionId/documents"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
[request setAllHTTPHeaderFields:headers];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/database/collections/:collectionId/documents" in
let headers = Header.add (Header.init ()) "x-appwrite-jwt" "{{apiKey}}" in
Client.call ~headers `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/database/collections/:collectionId/documents",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-appwrite-jwt: {{apiKey}}"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/database/collections/:collectionId/documents', [
'headers' => [
'x-appwrite-jwt' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/database/collections/:collectionId/documents');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders([
'x-appwrite-jwt' => '{{apiKey}}'
]);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/database/collections/:collectionId/documents');
$request->setRequestMethod('GET');
$request->setHeaders([
'x-appwrite-jwt' => '{{apiKey}}'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-appwrite-jwt", "{{apiKey}}")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/database/collections/:collectionId/documents' -Method GET -Headers $headers
$headers=@{}
$headers.Add("x-appwrite-jwt", "{{apiKey}}")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/database/collections/:collectionId/documents' -Method GET -Headers $headers
import http.client
conn = http.client.HTTPSConnection("example.com")
headers = { 'x-appwrite-jwt': "{{apiKey}}" }
conn.request("GET", "/baseUrl/database/collections/:collectionId/documents", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/database/collections/:collectionId/documents"
headers = {"x-appwrite-jwt": "{{apiKey}}"}
response = requests.get(url, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/database/collections/:collectionId/documents"
response <- VERB("GET", url, add_headers('x-appwrite-jwt' = '{{apiKey}}'), content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/database/collections/:collectionId/documents")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-appwrite-jwt"] = '{{apiKey}}'
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/database/collections/:collectionId/documents') do |req|
req.headers['x-appwrite-jwt'] = '{{apiKey}}'
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/database/collections/:collectionId/documents";
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-appwrite-jwt", "{{apiKey}}".parse().unwrap());
let client = reqwest::Client::new();
let response = client.get(url)
.headers(headers)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/database/collections/:collectionId/documents \
--header 'x-appwrite-jwt: {{apiKey}}'
http GET {{baseUrl}}/database/collections/:collectionId/documents \
x-appwrite-jwt:'{{apiKey}}'
wget --quiet \
--method GET \
--header 'x-appwrite-jwt: {{apiKey}}' \
--output-document \
- {{baseUrl}}/database/collections/:collectionId/documents
import Foundation
let headers = ["x-appwrite-jwt": "{{apiKey}}"]
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/database/collections/:collectionId/documents")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PATCH
Update Document
{{baseUrl}}/database/collections/:collectionId/documents/:documentId
HEADERS
X-Appwrite-JWT
{{apiKey}}
QUERY PARAMS
collectionId
documentId
BODY json
{
"data": {},
"read": [],
"write": []
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PATCH");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/database/collections/:collectionId/documents/:documentId");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-appwrite-jwt: {{apiKey}}");
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"data\": {},\n \"read\": [],\n \"write\": []\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/patch "{{baseUrl}}/database/collections/:collectionId/documents/:documentId" {:headers {:x-appwrite-jwt "{{apiKey}}"}
:content-type :json
:form-params {:data {}
:read []
:write []}})
require "http/client"
url = "{{baseUrl}}/database/collections/:collectionId/documents/:documentId"
headers = HTTP::Headers{
"x-appwrite-jwt" => "{{apiKey}}"
"content-type" => "application/json"
}
reqBody = "{\n \"data\": {},\n \"read\": [],\n \"write\": []\n}"
response = HTTP::Client.patch url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Patch,
RequestUri = new Uri("{{baseUrl}}/database/collections/:collectionId/documents/:documentId"),
Headers =
{
{ "x-appwrite-jwt", "{{apiKey}}" },
},
Content = new StringContent("{\n \"data\": {},\n \"read\": [],\n \"write\": []\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/database/collections/:collectionId/documents/:documentId");
var request = new RestRequest("", Method.Patch);
request.AddHeader("x-appwrite-jwt", "{{apiKey}}");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"data\": {},\n \"read\": [],\n \"write\": []\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/database/collections/:collectionId/documents/:documentId"
payload := strings.NewReader("{\n \"data\": {},\n \"read\": [],\n \"write\": []\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("x-appwrite-jwt", "{{apiKey}}")
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
PATCH /baseUrl/database/collections/:collectionId/documents/:documentId HTTP/1.1
X-Appwrite-Jwt: {{apiKey}}
Content-Type: application/json
Host: example.com
Content-Length: 45
{
"data": {},
"read": [],
"write": []
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PATCH", "{{baseUrl}}/database/collections/:collectionId/documents/:documentId")
.setHeader("x-appwrite-jwt", "{{apiKey}}")
.setHeader("content-type", "application/json")
.setBody("{\n \"data\": {},\n \"read\": [],\n \"write\": []\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/database/collections/:collectionId/documents/:documentId"))
.header("x-appwrite-jwt", "{{apiKey}}")
.header("content-type", "application/json")
.method("PATCH", HttpRequest.BodyPublishers.ofString("{\n \"data\": {},\n \"read\": [],\n \"write\": []\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"data\": {},\n \"read\": [],\n \"write\": []\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/database/collections/:collectionId/documents/:documentId")
.patch(body)
.addHeader("x-appwrite-jwt", "{{apiKey}}")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.patch("{{baseUrl}}/database/collections/:collectionId/documents/:documentId")
.header("x-appwrite-jwt", "{{apiKey}}")
.header("content-type", "application/json")
.body("{\n \"data\": {},\n \"read\": [],\n \"write\": []\n}")
.asString();
const data = JSON.stringify({
data: {},
read: [],
write: []
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PATCH', '{{baseUrl}}/database/collections/:collectionId/documents/:documentId');
xhr.setRequestHeader('x-appwrite-jwt', '{{apiKey}}');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PATCH',
url: '{{baseUrl}}/database/collections/:collectionId/documents/:documentId',
headers: {'x-appwrite-jwt': '{{apiKey}}', 'content-type': 'application/json'},
data: {data: {}, read: [], write: []}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/database/collections/:collectionId/documents/:documentId';
const options = {
method: 'PATCH',
headers: {'x-appwrite-jwt': '{{apiKey}}', 'content-type': 'application/json'},
body: '{"data":{},"read":[],"write":[]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/database/collections/:collectionId/documents/:documentId',
method: 'PATCH',
headers: {
'x-appwrite-jwt': '{{apiKey}}',
'content-type': 'application/json'
},
processData: false,
data: '{\n "data": {},\n "read": [],\n "write": []\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"data\": {},\n \"read\": [],\n \"write\": []\n}")
val request = Request.Builder()
.url("{{baseUrl}}/database/collections/:collectionId/documents/:documentId")
.patch(body)
.addHeader("x-appwrite-jwt", "{{apiKey}}")
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'PATCH',
hostname: 'example.com',
port: null,
path: '/baseUrl/database/collections/:collectionId/documents/:documentId',
headers: {
'x-appwrite-jwt': '{{apiKey}}',
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({data: {}, read: [], write: []}));
req.end();
const request = require('request');
const options = {
method: 'PATCH',
url: '{{baseUrl}}/database/collections/:collectionId/documents/:documentId',
headers: {'x-appwrite-jwt': '{{apiKey}}', 'content-type': 'application/json'},
body: {data: {}, read: [], write: []},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('PATCH', '{{baseUrl}}/database/collections/:collectionId/documents/:documentId');
req.headers({
'x-appwrite-jwt': '{{apiKey}}',
'content-type': 'application/json'
});
req.type('json');
req.send({
data: {},
read: [],
write: []
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'PATCH',
url: '{{baseUrl}}/database/collections/:collectionId/documents/:documentId',
headers: {'x-appwrite-jwt': '{{apiKey}}', 'content-type': 'application/json'},
data: {data: {}, read: [], write: []}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/database/collections/:collectionId/documents/:documentId';
const options = {
method: 'PATCH',
headers: {'x-appwrite-jwt': '{{apiKey}}', 'content-type': 'application/json'},
body: '{"data":{},"read":[],"write":[]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-appwrite-jwt": @"{{apiKey}}",
@"content-type": @"application/json" };
NSDictionary *parameters = @{ @"data": @{ },
@"read": @[ ],
@"write": @[ ] };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/database/collections/:collectionId/documents/:documentId"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"PATCH"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/database/collections/:collectionId/documents/:documentId" in
let headers = Header.add_list (Header.init ()) [
("x-appwrite-jwt", "{{apiKey}}");
("content-type", "application/json");
] in
let body = Cohttp_lwt_body.of_string "{\n \"data\": {},\n \"read\": [],\n \"write\": []\n}" in
Client.call ~headers ~body `PATCH uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/database/collections/:collectionId/documents/:documentId",
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([
'data' => [
],
'read' => [
],
'write' => [
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json",
"x-appwrite-jwt: {{apiKey}}"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('PATCH', '{{baseUrl}}/database/collections/:collectionId/documents/:documentId', [
'body' => '{
"data": {},
"read": [],
"write": []
}',
'headers' => [
'content-type' => 'application/json',
'x-appwrite-jwt' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/database/collections/:collectionId/documents/:documentId');
$request->setMethod(HttpRequest::HTTP_METH_PATCH);
$request->setHeaders([
'x-appwrite-jwt' => '{{apiKey}}',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'data' => [
],
'read' => [
],
'write' => [
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'data' => [
],
'read' => [
],
'write' => [
]
]));
$request->setRequestUrl('{{baseUrl}}/database/collections/:collectionId/documents/:documentId');
$request->setRequestMethod('PATCH');
$request->setBody($body);
$request->setHeaders([
'x-appwrite-jwt' => '{{apiKey}}',
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-appwrite-jwt", "{{apiKey}}")
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/database/collections/:collectionId/documents/:documentId' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"data": {},
"read": [],
"write": []
}'
$headers=@{}
$headers.Add("x-appwrite-jwt", "{{apiKey}}")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/database/collections/:collectionId/documents/:documentId' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"data": {},
"read": [],
"write": []
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"data\": {},\n \"read\": [],\n \"write\": []\n}"
headers = {
'x-appwrite-jwt': "{{apiKey}}",
'content-type': "application/json"
}
conn.request("PATCH", "/baseUrl/database/collections/:collectionId/documents/:documentId", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/database/collections/:collectionId/documents/:documentId"
payload = {
"data": {},
"read": [],
"write": []
}
headers = {
"x-appwrite-jwt": "{{apiKey}}",
"content-type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/database/collections/:collectionId/documents/:documentId"
payload <- "{\n \"data\": {},\n \"read\": [],\n \"write\": []\n}"
encode <- "json"
response <- VERB("PATCH", url, body = payload, add_headers('x-appwrite-jwt' = '{{apiKey}}'), content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/database/collections/:collectionId/documents/:documentId")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["x-appwrite-jwt"] = '{{apiKey}}'
request["content-type"] = 'application/json'
request.body = "{\n \"data\": {},\n \"read\": [],\n \"write\": []\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.patch('/baseUrl/database/collections/:collectionId/documents/:documentId') do |req|
req.headers['x-appwrite-jwt'] = '{{apiKey}}'
req.body = "{\n \"data\": {},\n \"read\": [],\n \"write\": []\n}"
end
puts response.status
puts response.body
use std::str::FromStr;
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/database/collections/:collectionId/documents/:documentId";
let payload = json!({
"data": json!({}),
"read": (),
"write": ()
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-appwrite-jwt", "{{apiKey}}".parse().unwrap());
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("PATCH").unwrap(), url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request PATCH \
--url {{baseUrl}}/database/collections/:collectionId/documents/:documentId \
--header 'content-type: application/json' \
--header 'x-appwrite-jwt: {{apiKey}}' \
--data '{
"data": {},
"read": [],
"write": []
}'
echo '{
"data": {},
"read": [],
"write": []
}' | \
http PATCH {{baseUrl}}/database/collections/:collectionId/documents/:documentId \
content-type:application/json \
x-appwrite-jwt:'{{apiKey}}'
wget --quiet \
--method PATCH \
--header 'x-appwrite-jwt: {{apiKey}}' \
--header 'content-type: application/json' \
--body-data '{\n "data": {},\n "read": [],\n "write": []\n}' \
--output-document \
- {{baseUrl}}/database/collections/:collectionId/documents/:documentId
import Foundation
let headers = [
"x-appwrite-jwt": "{{apiKey}}",
"content-type": "application/json"
]
let parameters = [
"data": [],
"read": [],
"write": []
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/database/collections/:collectionId/documents/:documentId")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PATCH"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
Create Execution
{{baseUrl}}/functions/:functionId/executions
HEADERS
X-Appwrite-JWT
{{apiKey}}
QUERY PARAMS
functionId
BODY json
{
"data": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/functions/:functionId/executions");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-appwrite-jwt: {{apiKey}}");
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"data\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/functions/:functionId/executions" {:headers {:x-appwrite-jwt "{{apiKey}}"}
:content-type :json
:form-params {:data ""}})
require "http/client"
url = "{{baseUrl}}/functions/:functionId/executions"
headers = HTTP::Headers{
"x-appwrite-jwt" => "{{apiKey}}"
"content-type" => "application/json"
}
reqBody = "{\n \"data\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/functions/:functionId/executions"),
Headers =
{
{ "x-appwrite-jwt", "{{apiKey}}" },
},
Content = new StringContent("{\n \"data\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/functions/:functionId/executions");
var request = new RestRequest("", Method.Post);
request.AddHeader("x-appwrite-jwt", "{{apiKey}}");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"data\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/functions/:functionId/executions"
payload := strings.NewReader("{\n \"data\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-appwrite-jwt", "{{apiKey}}")
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/functions/:functionId/executions HTTP/1.1
X-Appwrite-Jwt: {{apiKey}}
Content-Type: application/json
Host: example.com
Content-Length: 16
{
"data": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/functions/:functionId/executions")
.setHeader("x-appwrite-jwt", "{{apiKey}}")
.setHeader("content-type", "application/json")
.setBody("{\n \"data\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/functions/:functionId/executions"))
.header("x-appwrite-jwt", "{{apiKey}}")
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"data\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"data\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/functions/:functionId/executions")
.post(body)
.addHeader("x-appwrite-jwt", "{{apiKey}}")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/functions/:functionId/executions")
.header("x-appwrite-jwt", "{{apiKey}}")
.header("content-type", "application/json")
.body("{\n \"data\": \"\"\n}")
.asString();
const data = JSON.stringify({
data: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/functions/:functionId/executions');
xhr.setRequestHeader('x-appwrite-jwt', '{{apiKey}}');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/functions/:functionId/executions',
headers: {'x-appwrite-jwt': '{{apiKey}}', 'content-type': 'application/json'},
data: {data: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/functions/:functionId/executions';
const options = {
method: 'POST',
headers: {'x-appwrite-jwt': '{{apiKey}}', 'content-type': 'application/json'},
body: '{"data":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/functions/:functionId/executions',
method: 'POST',
headers: {
'x-appwrite-jwt': '{{apiKey}}',
'content-type': 'application/json'
},
processData: false,
data: '{\n "data": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"data\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/functions/:functionId/executions")
.post(body)
.addHeader("x-appwrite-jwt", "{{apiKey}}")
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/functions/:functionId/executions',
headers: {
'x-appwrite-jwt': '{{apiKey}}',
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({data: ''}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/functions/:functionId/executions',
headers: {'x-appwrite-jwt': '{{apiKey}}', 'content-type': 'application/json'},
body: {data: ''},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/functions/:functionId/executions');
req.headers({
'x-appwrite-jwt': '{{apiKey}}',
'content-type': 'application/json'
});
req.type('json');
req.send({
data: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/functions/:functionId/executions',
headers: {'x-appwrite-jwt': '{{apiKey}}', 'content-type': 'application/json'},
data: {data: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/functions/:functionId/executions';
const options = {
method: 'POST',
headers: {'x-appwrite-jwt': '{{apiKey}}', 'content-type': 'application/json'},
body: '{"data":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-appwrite-jwt": @"{{apiKey}}",
@"content-type": @"application/json" };
NSDictionary *parameters = @{ @"data": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/functions/:functionId/executions"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/functions/:functionId/executions" in
let headers = Header.add_list (Header.init ()) [
("x-appwrite-jwt", "{{apiKey}}");
("content-type", "application/json");
] in
let body = Cohttp_lwt_body.of_string "{\n \"data\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/functions/:functionId/executions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'data' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json",
"x-appwrite-jwt: {{apiKey}}"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/functions/:functionId/executions', [
'body' => '{
"data": ""
}',
'headers' => [
'content-type' => 'application/json',
'x-appwrite-jwt' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/functions/:functionId/executions');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'x-appwrite-jwt' => '{{apiKey}}',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'data' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'data' => ''
]));
$request->setRequestUrl('{{baseUrl}}/functions/:functionId/executions');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'x-appwrite-jwt' => '{{apiKey}}',
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-appwrite-jwt", "{{apiKey}}")
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/functions/:functionId/executions' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"data": ""
}'
$headers=@{}
$headers.Add("x-appwrite-jwt", "{{apiKey}}")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/functions/:functionId/executions' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"data": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"data\": \"\"\n}"
headers = {
'x-appwrite-jwt': "{{apiKey}}",
'content-type': "application/json"
}
conn.request("POST", "/baseUrl/functions/:functionId/executions", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/functions/:functionId/executions"
payload = { "data": "" }
headers = {
"x-appwrite-jwt": "{{apiKey}}",
"content-type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/functions/:functionId/executions"
payload <- "{\n \"data\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, add_headers('x-appwrite-jwt' = '{{apiKey}}'), content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/functions/:functionId/executions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-appwrite-jwt"] = '{{apiKey}}'
request["content-type"] = 'application/json'
request.body = "{\n \"data\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/functions/:functionId/executions') do |req|
req.headers['x-appwrite-jwt'] = '{{apiKey}}'
req.body = "{\n \"data\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/functions/:functionId/executions";
let payload = json!({"data": ""});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-appwrite-jwt", "{{apiKey}}".parse().unwrap());
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/functions/:functionId/executions \
--header 'content-type: application/json' \
--header 'x-appwrite-jwt: {{apiKey}}' \
--data '{
"data": ""
}'
echo '{
"data": ""
}' | \
http POST {{baseUrl}}/functions/:functionId/executions \
content-type:application/json \
x-appwrite-jwt:'{{apiKey}}'
wget --quiet \
--method POST \
--header 'x-appwrite-jwt: {{apiKey}}' \
--header 'content-type: application/json' \
--body-data '{\n "data": ""\n}' \
--output-document \
- {{baseUrl}}/functions/:functionId/executions
import Foundation
let headers = [
"x-appwrite-jwt": "{{apiKey}}",
"content-type": "application/json"
]
let parameters = ["data": ""] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/functions/:functionId/executions")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
Get Execution
{{baseUrl}}/functions/:functionId/executions/:executionId
HEADERS
X-Appwrite-JWT
{{apiKey}}
QUERY PARAMS
functionId
executionId
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/functions/:functionId/executions/:executionId");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-appwrite-jwt: {{apiKey}}");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/functions/:functionId/executions/:executionId" {:headers {:x-appwrite-jwt "{{apiKey}}"}})
require "http/client"
url = "{{baseUrl}}/functions/:functionId/executions/:executionId"
headers = HTTP::Headers{
"x-appwrite-jwt" => "{{apiKey}}"
}
response = HTTP::Client.get url, headers: headers
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/functions/:functionId/executions/:executionId"),
Headers =
{
{ "x-appwrite-jwt", "{{apiKey}}" },
},
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/functions/:functionId/executions/:executionId");
var request = new RestRequest("", Method.Get);
request.AddHeader("x-appwrite-jwt", "{{apiKey}}");
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/functions/:functionId/executions/:executionId"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-appwrite-jwt", "{{apiKey}}")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/functions/:functionId/executions/:executionId HTTP/1.1
X-Appwrite-Jwt: {{apiKey}}
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/functions/:functionId/executions/:executionId")
.setHeader("x-appwrite-jwt", "{{apiKey}}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/functions/:functionId/executions/:executionId"))
.header("x-appwrite-jwt", "{{apiKey}}")
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/functions/:functionId/executions/:executionId")
.get()
.addHeader("x-appwrite-jwt", "{{apiKey}}")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/functions/:functionId/executions/:executionId")
.header("x-appwrite-jwt", "{{apiKey}}")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/functions/:functionId/executions/:executionId');
xhr.setRequestHeader('x-appwrite-jwt', '{{apiKey}}');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/functions/:functionId/executions/:executionId',
headers: {'x-appwrite-jwt': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/functions/:functionId/executions/:executionId';
const options = {method: 'GET', headers: {'x-appwrite-jwt': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/functions/:functionId/executions/:executionId',
method: 'GET',
headers: {
'x-appwrite-jwt': '{{apiKey}}'
}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/functions/:functionId/executions/:executionId")
.get()
.addHeader("x-appwrite-jwt", "{{apiKey}}")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/functions/:functionId/executions/:executionId',
headers: {
'x-appwrite-jwt': '{{apiKey}}'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/functions/:functionId/executions/:executionId',
headers: {'x-appwrite-jwt': '{{apiKey}}'}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/functions/:functionId/executions/:executionId');
req.headers({
'x-appwrite-jwt': '{{apiKey}}'
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/functions/:functionId/executions/:executionId',
headers: {'x-appwrite-jwt': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/functions/:functionId/executions/:executionId';
const options = {method: 'GET', headers: {'x-appwrite-jwt': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-appwrite-jwt": @"{{apiKey}}" };
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/functions/:functionId/executions/:executionId"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
[request setAllHTTPHeaderFields:headers];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/functions/:functionId/executions/:executionId" in
let headers = Header.add (Header.init ()) "x-appwrite-jwt" "{{apiKey}}" in
Client.call ~headers `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/functions/:functionId/executions/:executionId",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-appwrite-jwt: {{apiKey}}"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/functions/:functionId/executions/:executionId', [
'headers' => [
'x-appwrite-jwt' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/functions/:functionId/executions/:executionId');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders([
'x-appwrite-jwt' => '{{apiKey}}'
]);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/functions/:functionId/executions/:executionId');
$request->setRequestMethod('GET');
$request->setHeaders([
'x-appwrite-jwt' => '{{apiKey}}'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-appwrite-jwt", "{{apiKey}}")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/functions/:functionId/executions/:executionId' -Method GET -Headers $headers
$headers=@{}
$headers.Add("x-appwrite-jwt", "{{apiKey}}")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/functions/:functionId/executions/:executionId' -Method GET -Headers $headers
import http.client
conn = http.client.HTTPSConnection("example.com")
headers = { 'x-appwrite-jwt': "{{apiKey}}" }
conn.request("GET", "/baseUrl/functions/:functionId/executions/:executionId", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/functions/:functionId/executions/:executionId"
headers = {"x-appwrite-jwt": "{{apiKey}}"}
response = requests.get(url, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/functions/:functionId/executions/:executionId"
response <- VERB("GET", url, add_headers('x-appwrite-jwt' = '{{apiKey}}'), content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/functions/:functionId/executions/:executionId")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-appwrite-jwt"] = '{{apiKey}}'
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/functions/:functionId/executions/:executionId') do |req|
req.headers['x-appwrite-jwt'] = '{{apiKey}}'
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/functions/:functionId/executions/:executionId";
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-appwrite-jwt", "{{apiKey}}".parse().unwrap());
let client = reqwest::Client::new();
let response = client.get(url)
.headers(headers)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/functions/:functionId/executions/:executionId \
--header 'x-appwrite-jwt: {{apiKey}}'
http GET {{baseUrl}}/functions/:functionId/executions/:executionId \
x-appwrite-jwt:'{{apiKey}}'
wget --quiet \
--method GET \
--header 'x-appwrite-jwt: {{apiKey}}' \
--output-document \
- {{baseUrl}}/functions/:functionId/executions/:executionId
import Foundation
let headers = ["x-appwrite-jwt": "{{apiKey}}"]
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/functions/:functionId/executions/:executionId")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
List Executions
{{baseUrl}}/functions/:functionId/executions
HEADERS
X-Appwrite-JWT
{{apiKey}}
QUERY PARAMS
functionId
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/functions/:functionId/executions");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-appwrite-jwt: {{apiKey}}");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/functions/:functionId/executions" {:headers {:x-appwrite-jwt "{{apiKey}}"}})
require "http/client"
url = "{{baseUrl}}/functions/:functionId/executions"
headers = HTTP::Headers{
"x-appwrite-jwt" => "{{apiKey}}"
}
response = HTTP::Client.get url, headers: headers
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/functions/:functionId/executions"),
Headers =
{
{ "x-appwrite-jwt", "{{apiKey}}" },
},
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/functions/:functionId/executions");
var request = new RestRequest("", Method.Get);
request.AddHeader("x-appwrite-jwt", "{{apiKey}}");
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/functions/:functionId/executions"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-appwrite-jwt", "{{apiKey}}")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/functions/:functionId/executions HTTP/1.1
X-Appwrite-Jwt: {{apiKey}}
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/functions/:functionId/executions")
.setHeader("x-appwrite-jwt", "{{apiKey}}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/functions/:functionId/executions"))
.header("x-appwrite-jwt", "{{apiKey}}")
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/functions/:functionId/executions")
.get()
.addHeader("x-appwrite-jwt", "{{apiKey}}")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/functions/:functionId/executions")
.header("x-appwrite-jwt", "{{apiKey}}")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/functions/:functionId/executions');
xhr.setRequestHeader('x-appwrite-jwt', '{{apiKey}}');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/functions/:functionId/executions',
headers: {'x-appwrite-jwt': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/functions/:functionId/executions';
const options = {method: 'GET', headers: {'x-appwrite-jwt': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/functions/:functionId/executions',
method: 'GET',
headers: {
'x-appwrite-jwt': '{{apiKey}}'
}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/functions/:functionId/executions")
.get()
.addHeader("x-appwrite-jwt", "{{apiKey}}")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/functions/:functionId/executions',
headers: {
'x-appwrite-jwt': '{{apiKey}}'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/functions/:functionId/executions',
headers: {'x-appwrite-jwt': '{{apiKey}}'}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/functions/:functionId/executions');
req.headers({
'x-appwrite-jwt': '{{apiKey}}'
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/functions/:functionId/executions',
headers: {'x-appwrite-jwt': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/functions/:functionId/executions';
const options = {method: 'GET', headers: {'x-appwrite-jwt': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-appwrite-jwt": @"{{apiKey}}" };
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/functions/:functionId/executions"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
[request setAllHTTPHeaderFields:headers];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/functions/:functionId/executions" in
let headers = Header.add (Header.init ()) "x-appwrite-jwt" "{{apiKey}}" in
Client.call ~headers `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/functions/:functionId/executions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-appwrite-jwt: {{apiKey}}"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/functions/:functionId/executions', [
'headers' => [
'x-appwrite-jwt' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/functions/:functionId/executions');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders([
'x-appwrite-jwt' => '{{apiKey}}'
]);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/functions/:functionId/executions');
$request->setRequestMethod('GET');
$request->setHeaders([
'x-appwrite-jwt' => '{{apiKey}}'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-appwrite-jwt", "{{apiKey}}")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/functions/:functionId/executions' -Method GET -Headers $headers
$headers=@{}
$headers.Add("x-appwrite-jwt", "{{apiKey}}")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/functions/:functionId/executions' -Method GET -Headers $headers
import http.client
conn = http.client.HTTPSConnection("example.com")
headers = { 'x-appwrite-jwt': "{{apiKey}}" }
conn.request("GET", "/baseUrl/functions/:functionId/executions", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/functions/:functionId/executions"
headers = {"x-appwrite-jwt": "{{apiKey}}"}
response = requests.get(url, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/functions/:functionId/executions"
response <- VERB("GET", url, add_headers('x-appwrite-jwt' = '{{apiKey}}'), content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/functions/:functionId/executions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-appwrite-jwt"] = '{{apiKey}}'
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/functions/:functionId/executions') do |req|
req.headers['x-appwrite-jwt'] = '{{apiKey}}'
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/functions/:functionId/executions";
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-appwrite-jwt", "{{apiKey}}".parse().unwrap());
let client = reqwest::Client::new();
let response = client.get(url)
.headers(headers)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/functions/:functionId/executions \
--header 'x-appwrite-jwt: {{apiKey}}'
http GET {{baseUrl}}/functions/:functionId/executions \
x-appwrite-jwt:'{{apiKey}}'
wget --quiet \
--method GET \
--header 'x-appwrite-jwt: {{apiKey}}' \
--output-document \
- {{baseUrl}}/functions/:functionId/executions
import Foundation
let headers = ["x-appwrite-jwt": "{{apiKey}}"]
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/functions/:functionId/executions")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
Get User Locale
{{baseUrl}}/locale
HEADERS
X-Appwrite-JWT
{{apiKey}}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/locale");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-appwrite-jwt: {{apiKey}}");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/locale" {:headers {:x-appwrite-jwt "{{apiKey}}"}})
require "http/client"
url = "{{baseUrl}}/locale"
headers = HTTP::Headers{
"x-appwrite-jwt" => "{{apiKey}}"
}
response = HTTP::Client.get url, headers: headers
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/locale"),
Headers =
{
{ "x-appwrite-jwt", "{{apiKey}}" },
},
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/locale");
var request = new RestRequest("", Method.Get);
request.AddHeader("x-appwrite-jwt", "{{apiKey}}");
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/locale"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-appwrite-jwt", "{{apiKey}}")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/locale HTTP/1.1
X-Appwrite-Jwt: {{apiKey}}
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/locale")
.setHeader("x-appwrite-jwt", "{{apiKey}}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/locale"))
.header("x-appwrite-jwt", "{{apiKey}}")
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/locale")
.get()
.addHeader("x-appwrite-jwt", "{{apiKey}}")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/locale")
.header("x-appwrite-jwt", "{{apiKey}}")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/locale');
xhr.setRequestHeader('x-appwrite-jwt', '{{apiKey}}');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/locale',
headers: {'x-appwrite-jwt': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/locale';
const options = {method: 'GET', headers: {'x-appwrite-jwt': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/locale',
method: 'GET',
headers: {
'x-appwrite-jwt': '{{apiKey}}'
}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/locale")
.get()
.addHeader("x-appwrite-jwt", "{{apiKey}}")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/locale',
headers: {
'x-appwrite-jwt': '{{apiKey}}'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/locale',
headers: {'x-appwrite-jwt': '{{apiKey}}'}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/locale');
req.headers({
'x-appwrite-jwt': '{{apiKey}}'
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/locale',
headers: {'x-appwrite-jwt': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/locale';
const options = {method: 'GET', headers: {'x-appwrite-jwt': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-appwrite-jwt": @"{{apiKey}}" };
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/locale"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
[request setAllHTTPHeaderFields:headers];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/locale" in
let headers = Header.add (Header.init ()) "x-appwrite-jwt" "{{apiKey}}" in
Client.call ~headers `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/locale",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-appwrite-jwt: {{apiKey}}"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/locale', [
'headers' => [
'x-appwrite-jwt' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/locale');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders([
'x-appwrite-jwt' => '{{apiKey}}'
]);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/locale');
$request->setRequestMethod('GET');
$request->setHeaders([
'x-appwrite-jwt' => '{{apiKey}}'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-appwrite-jwt", "{{apiKey}}")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/locale' -Method GET -Headers $headers
$headers=@{}
$headers.Add("x-appwrite-jwt", "{{apiKey}}")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/locale' -Method GET -Headers $headers
import http.client
conn = http.client.HTTPSConnection("example.com")
headers = { 'x-appwrite-jwt': "{{apiKey}}" }
conn.request("GET", "/baseUrl/locale", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/locale"
headers = {"x-appwrite-jwt": "{{apiKey}}"}
response = requests.get(url, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/locale"
response <- VERB("GET", url, add_headers('x-appwrite-jwt' = '{{apiKey}}'), content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/locale")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-appwrite-jwt"] = '{{apiKey}}'
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/locale') do |req|
req.headers['x-appwrite-jwt'] = '{{apiKey}}'
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/locale";
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-appwrite-jwt", "{{apiKey}}".parse().unwrap());
let client = reqwest::Client::new();
let response = client.get(url)
.headers(headers)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/locale \
--header 'x-appwrite-jwt: {{apiKey}}'
http GET {{baseUrl}}/locale \
x-appwrite-jwt:'{{apiKey}}'
wget --quiet \
--method GET \
--header 'x-appwrite-jwt: {{apiKey}}' \
--output-document \
- {{baseUrl}}/locale
import Foundation
let headers = ["x-appwrite-jwt": "{{apiKey}}"]
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/locale")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
List Continents
{{baseUrl}}/locale/continents
HEADERS
X-Appwrite-JWT
{{apiKey}}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/locale/continents");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-appwrite-jwt: {{apiKey}}");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/locale/continents" {:headers {:x-appwrite-jwt "{{apiKey}}"}})
require "http/client"
url = "{{baseUrl}}/locale/continents"
headers = HTTP::Headers{
"x-appwrite-jwt" => "{{apiKey}}"
}
response = HTTP::Client.get url, headers: headers
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/locale/continents"),
Headers =
{
{ "x-appwrite-jwt", "{{apiKey}}" },
},
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/locale/continents");
var request = new RestRequest("", Method.Get);
request.AddHeader("x-appwrite-jwt", "{{apiKey}}");
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/locale/continents"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-appwrite-jwt", "{{apiKey}}")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/locale/continents HTTP/1.1
X-Appwrite-Jwt: {{apiKey}}
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/locale/continents")
.setHeader("x-appwrite-jwt", "{{apiKey}}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/locale/continents"))
.header("x-appwrite-jwt", "{{apiKey}}")
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/locale/continents")
.get()
.addHeader("x-appwrite-jwt", "{{apiKey}}")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/locale/continents")
.header("x-appwrite-jwt", "{{apiKey}}")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/locale/continents');
xhr.setRequestHeader('x-appwrite-jwt', '{{apiKey}}');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/locale/continents',
headers: {'x-appwrite-jwt': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/locale/continents';
const options = {method: 'GET', headers: {'x-appwrite-jwt': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/locale/continents',
method: 'GET',
headers: {
'x-appwrite-jwt': '{{apiKey}}'
}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/locale/continents")
.get()
.addHeader("x-appwrite-jwt", "{{apiKey}}")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/locale/continents',
headers: {
'x-appwrite-jwt': '{{apiKey}}'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/locale/continents',
headers: {'x-appwrite-jwt': '{{apiKey}}'}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/locale/continents');
req.headers({
'x-appwrite-jwt': '{{apiKey}}'
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/locale/continents',
headers: {'x-appwrite-jwt': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/locale/continents';
const options = {method: 'GET', headers: {'x-appwrite-jwt': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-appwrite-jwt": @"{{apiKey}}" };
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/locale/continents"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
[request setAllHTTPHeaderFields:headers];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/locale/continents" in
let headers = Header.add (Header.init ()) "x-appwrite-jwt" "{{apiKey}}" in
Client.call ~headers `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/locale/continents",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-appwrite-jwt: {{apiKey}}"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/locale/continents', [
'headers' => [
'x-appwrite-jwt' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/locale/continents');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders([
'x-appwrite-jwt' => '{{apiKey}}'
]);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/locale/continents');
$request->setRequestMethod('GET');
$request->setHeaders([
'x-appwrite-jwt' => '{{apiKey}}'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-appwrite-jwt", "{{apiKey}}")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/locale/continents' -Method GET -Headers $headers
$headers=@{}
$headers.Add("x-appwrite-jwt", "{{apiKey}}")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/locale/continents' -Method GET -Headers $headers
import http.client
conn = http.client.HTTPSConnection("example.com")
headers = { 'x-appwrite-jwt': "{{apiKey}}" }
conn.request("GET", "/baseUrl/locale/continents", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/locale/continents"
headers = {"x-appwrite-jwt": "{{apiKey}}"}
response = requests.get(url, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/locale/continents"
response <- VERB("GET", url, add_headers('x-appwrite-jwt' = '{{apiKey}}'), content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/locale/continents")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-appwrite-jwt"] = '{{apiKey}}'
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/locale/continents') do |req|
req.headers['x-appwrite-jwt'] = '{{apiKey}}'
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/locale/continents";
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-appwrite-jwt", "{{apiKey}}".parse().unwrap());
let client = reqwest::Client::new();
let response = client.get(url)
.headers(headers)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/locale/continents \
--header 'x-appwrite-jwt: {{apiKey}}'
http GET {{baseUrl}}/locale/continents \
x-appwrite-jwt:'{{apiKey}}'
wget --quiet \
--method GET \
--header 'x-appwrite-jwt: {{apiKey}}' \
--output-document \
- {{baseUrl}}/locale/continents
import Foundation
let headers = ["x-appwrite-jwt": "{{apiKey}}"]
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/locale/continents")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
List Countries Phone Codes
{{baseUrl}}/locale/countries/phones
HEADERS
X-Appwrite-JWT
{{apiKey}}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/locale/countries/phones");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-appwrite-jwt: {{apiKey}}");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/locale/countries/phones" {:headers {:x-appwrite-jwt "{{apiKey}}"}})
require "http/client"
url = "{{baseUrl}}/locale/countries/phones"
headers = HTTP::Headers{
"x-appwrite-jwt" => "{{apiKey}}"
}
response = HTTP::Client.get url, headers: headers
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/locale/countries/phones"),
Headers =
{
{ "x-appwrite-jwt", "{{apiKey}}" },
},
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/locale/countries/phones");
var request = new RestRequest("", Method.Get);
request.AddHeader("x-appwrite-jwt", "{{apiKey}}");
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/locale/countries/phones"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-appwrite-jwt", "{{apiKey}}")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/locale/countries/phones HTTP/1.1
X-Appwrite-Jwt: {{apiKey}}
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/locale/countries/phones")
.setHeader("x-appwrite-jwt", "{{apiKey}}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/locale/countries/phones"))
.header("x-appwrite-jwt", "{{apiKey}}")
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/locale/countries/phones")
.get()
.addHeader("x-appwrite-jwt", "{{apiKey}}")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/locale/countries/phones")
.header("x-appwrite-jwt", "{{apiKey}}")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/locale/countries/phones');
xhr.setRequestHeader('x-appwrite-jwt', '{{apiKey}}');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/locale/countries/phones',
headers: {'x-appwrite-jwt': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/locale/countries/phones';
const options = {method: 'GET', headers: {'x-appwrite-jwt': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/locale/countries/phones',
method: 'GET',
headers: {
'x-appwrite-jwt': '{{apiKey}}'
}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/locale/countries/phones")
.get()
.addHeader("x-appwrite-jwt", "{{apiKey}}")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/locale/countries/phones',
headers: {
'x-appwrite-jwt': '{{apiKey}}'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/locale/countries/phones',
headers: {'x-appwrite-jwt': '{{apiKey}}'}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/locale/countries/phones');
req.headers({
'x-appwrite-jwt': '{{apiKey}}'
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/locale/countries/phones',
headers: {'x-appwrite-jwt': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/locale/countries/phones';
const options = {method: 'GET', headers: {'x-appwrite-jwt': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-appwrite-jwt": @"{{apiKey}}" };
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/locale/countries/phones"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
[request setAllHTTPHeaderFields:headers];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/locale/countries/phones" in
let headers = Header.add (Header.init ()) "x-appwrite-jwt" "{{apiKey}}" in
Client.call ~headers `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/locale/countries/phones",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-appwrite-jwt: {{apiKey}}"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/locale/countries/phones', [
'headers' => [
'x-appwrite-jwt' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/locale/countries/phones');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders([
'x-appwrite-jwt' => '{{apiKey}}'
]);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/locale/countries/phones');
$request->setRequestMethod('GET');
$request->setHeaders([
'x-appwrite-jwt' => '{{apiKey}}'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-appwrite-jwt", "{{apiKey}}")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/locale/countries/phones' -Method GET -Headers $headers
$headers=@{}
$headers.Add("x-appwrite-jwt", "{{apiKey}}")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/locale/countries/phones' -Method GET -Headers $headers
import http.client
conn = http.client.HTTPSConnection("example.com")
headers = { 'x-appwrite-jwt': "{{apiKey}}" }
conn.request("GET", "/baseUrl/locale/countries/phones", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/locale/countries/phones"
headers = {"x-appwrite-jwt": "{{apiKey}}"}
response = requests.get(url, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/locale/countries/phones"
response <- VERB("GET", url, add_headers('x-appwrite-jwt' = '{{apiKey}}'), content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/locale/countries/phones")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-appwrite-jwt"] = '{{apiKey}}'
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/locale/countries/phones') do |req|
req.headers['x-appwrite-jwt'] = '{{apiKey}}'
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/locale/countries/phones";
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-appwrite-jwt", "{{apiKey}}".parse().unwrap());
let client = reqwest::Client::new();
let response = client.get(url)
.headers(headers)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/locale/countries/phones \
--header 'x-appwrite-jwt: {{apiKey}}'
http GET {{baseUrl}}/locale/countries/phones \
x-appwrite-jwt:'{{apiKey}}'
wget --quiet \
--method GET \
--header 'x-appwrite-jwt: {{apiKey}}' \
--output-document \
- {{baseUrl}}/locale/countries/phones
import Foundation
let headers = ["x-appwrite-jwt": "{{apiKey}}"]
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/locale/countries/phones")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
List Countries
{{baseUrl}}/locale/countries
HEADERS
X-Appwrite-JWT
{{apiKey}}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/locale/countries");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-appwrite-jwt: {{apiKey}}");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/locale/countries" {:headers {:x-appwrite-jwt "{{apiKey}}"}})
require "http/client"
url = "{{baseUrl}}/locale/countries"
headers = HTTP::Headers{
"x-appwrite-jwt" => "{{apiKey}}"
}
response = HTTP::Client.get url, headers: headers
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/locale/countries"),
Headers =
{
{ "x-appwrite-jwt", "{{apiKey}}" },
},
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/locale/countries");
var request = new RestRequest("", Method.Get);
request.AddHeader("x-appwrite-jwt", "{{apiKey}}");
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/locale/countries"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-appwrite-jwt", "{{apiKey}}")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/locale/countries HTTP/1.1
X-Appwrite-Jwt: {{apiKey}}
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/locale/countries")
.setHeader("x-appwrite-jwt", "{{apiKey}}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/locale/countries"))
.header("x-appwrite-jwt", "{{apiKey}}")
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/locale/countries")
.get()
.addHeader("x-appwrite-jwt", "{{apiKey}}")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/locale/countries")
.header("x-appwrite-jwt", "{{apiKey}}")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/locale/countries');
xhr.setRequestHeader('x-appwrite-jwt', '{{apiKey}}');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/locale/countries',
headers: {'x-appwrite-jwt': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/locale/countries';
const options = {method: 'GET', headers: {'x-appwrite-jwt': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/locale/countries',
method: 'GET',
headers: {
'x-appwrite-jwt': '{{apiKey}}'
}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/locale/countries")
.get()
.addHeader("x-appwrite-jwt", "{{apiKey}}")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/locale/countries',
headers: {
'x-appwrite-jwt': '{{apiKey}}'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/locale/countries',
headers: {'x-appwrite-jwt': '{{apiKey}}'}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/locale/countries');
req.headers({
'x-appwrite-jwt': '{{apiKey}}'
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/locale/countries',
headers: {'x-appwrite-jwt': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/locale/countries';
const options = {method: 'GET', headers: {'x-appwrite-jwt': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-appwrite-jwt": @"{{apiKey}}" };
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/locale/countries"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
[request setAllHTTPHeaderFields:headers];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/locale/countries" in
let headers = Header.add (Header.init ()) "x-appwrite-jwt" "{{apiKey}}" in
Client.call ~headers `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/locale/countries",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-appwrite-jwt: {{apiKey}}"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/locale/countries', [
'headers' => [
'x-appwrite-jwt' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/locale/countries');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders([
'x-appwrite-jwt' => '{{apiKey}}'
]);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/locale/countries');
$request->setRequestMethod('GET');
$request->setHeaders([
'x-appwrite-jwt' => '{{apiKey}}'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-appwrite-jwt", "{{apiKey}}")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/locale/countries' -Method GET -Headers $headers
$headers=@{}
$headers.Add("x-appwrite-jwt", "{{apiKey}}")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/locale/countries' -Method GET -Headers $headers
import http.client
conn = http.client.HTTPSConnection("example.com")
headers = { 'x-appwrite-jwt': "{{apiKey}}" }
conn.request("GET", "/baseUrl/locale/countries", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/locale/countries"
headers = {"x-appwrite-jwt": "{{apiKey}}"}
response = requests.get(url, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/locale/countries"
response <- VERB("GET", url, add_headers('x-appwrite-jwt' = '{{apiKey}}'), content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/locale/countries")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-appwrite-jwt"] = '{{apiKey}}'
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/locale/countries') do |req|
req.headers['x-appwrite-jwt'] = '{{apiKey}}'
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/locale/countries";
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-appwrite-jwt", "{{apiKey}}".parse().unwrap());
let client = reqwest::Client::new();
let response = client.get(url)
.headers(headers)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/locale/countries \
--header 'x-appwrite-jwt: {{apiKey}}'
http GET {{baseUrl}}/locale/countries \
x-appwrite-jwt:'{{apiKey}}'
wget --quiet \
--method GET \
--header 'x-appwrite-jwt: {{apiKey}}' \
--output-document \
- {{baseUrl}}/locale/countries
import Foundation
let headers = ["x-appwrite-jwt": "{{apiKey}}"]
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/locale/countries")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
List Currencies
{{baseUrl}}/locale/currencies
HEADERS
X-Appwrite-JWT
{{apiKey}}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/locale/currencies");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-appwrite-jwt: {{apiKey}}");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/locale/currencies" {:headers {:x-appwrite-jwt "{{apiKey}}"}})
require "http/client"
url = "{{baseUrl}}/locale/currencies"
headers = HTTP::Headers{
"x-appwrite-jwt" => "{{apiKey}}"
}
response = HTTP::Client.get url, headers: headers
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/locale/currencies"),
Headers =
{
{ "x-appwrite-jwt", "{{apiKey}}" },
},
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/locale/currencies");
var request = new RestRequest("", Method.Get);
request.AddHeader("x-appwrite-jwt", "{{apiKey}}");
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/locale/currencies"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-appwrite-jwt", "{{apiKey}}")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/locale/currencies HTTP/1.1
X-Appwrite-Jwt: {{apiKey}}
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/locale/currencies")
.setHeader("x-appwrite-jwt", "{{apiKey}}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/locale/currencies"))
.header("x-appwrite-jwt", "{{apiKey}}")
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/locale/currencies")
.get()
.addHeader("x-appwrite-jwt", "{{apiKey}}")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/locale/currencies")
.header("x-appwrite-jwt", "{{apiKey}}")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/locale/currencies');
xhr.setRequestHeader('x-appwrite-jwt', '{{apiKey}}');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/locale/currencies',
headers: {'x-appwrite-jwt': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/locale/currencies';
const options = {method: 'GET', headers: {'x-appwrite-jwt': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/locale/currencies',
method: 'GET',
headers: {
'x-appwrite-jwt': '{{apiKey}}'
}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/locale/currencies")
.get()
.addHeader("x-appwrite-jwt", "{{apiKey}}")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/locale/currencies',
headers: {
'x-appwrite-jwt': '{{apiKey}}'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/locale/currencies',
headers: {'x-appwrite-jwt': '{{apiKey}}'}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/locale/currencies');
req.headers({
'x-appwrite-jwt': '{{apiKey}}'
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/locale/currencies',
headers: {'x-appwrite-jwt': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/locale/currencies';
const options = {method: 'GET', headers: {'x-appwrite-jwt': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-appwrite-jwt": @"{{apiKey}}" };
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/locale/currencies"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
[request setAllHTTPHeaderFields:headers];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/locale/currencies" in
let headers = Header.add (Header.init ()) "x-appwrite-jwt" "{{apiKey}}" in
Client.call ~headers `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/locale/currencies",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-appwrite-jwt: {{apiKey}}"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/locale/currencies', [
'headers' => [
'x-appwrite-jwt' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/locale/currencies');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders([
'x-appwrite-jwt' => '{{apiKey}}'
]);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/locale/currencies');
$request->setRequestMethod('GET');
$request->setHeaders([
'x-appwrite-jwt' => '{{apiKey}}'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-appwrite-jwt", "{{apiKey}}")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/locale/currencies' -Method GET -Headers $headers
$headers=@{}
$headers.Add("x-appwrite-jwt", "{{apiKey}}")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/locale/currencies' -Method GET -Headers $headers
import http.client
conn = http.client.HTTPSConnection("example.com")
headers = { 'x-appwrite-jwt': "{{apiKey}}" }
conn.request("GET", "/baseUrl/locale/currencies", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/locale/currencies"
headers = {"x-appwrite-jwt": "{{apiKey}}"}
response = requests.get(url, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/locale/currencies"
response <- VERB("GET", url, add_headers('x-appwrite-jwt' = '{{apiKey}}'), content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/locale/currencies")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-appwrite-jwt"] = '{{apiKey}}'
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/locale/currencies') do |req|
req.headers['x-appwrite-jwt'] = '{{apiKey}}'
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/locale/currencies";
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-appwrite-jwt", "{{apiKey}}".parse().unwrap());
let client = reqwest::Client::new();
let response = client.get(url)
.headers(headers)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/locale/currencies \
--header 'x-appwrite-jwt: {{apiKey}}'
http GET {{baseUrl}}/locale/currencies \
x-appwrite-jwt:'{{apiKey}}'
wget --quiet \
--method GET \
--header 'x-appwrite-jwt: {{apiKey}}' \
--output-document \
- {{baseUrl}}/locale/currencies
import Foundation
let headers = ["x-appwrite-jwt": "{{apiKey}}"]
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/locale/currencies")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
List EU Countries
{{baseUrl}}/locale/countries/eu
HEADERS
X-Appwrite-JWT
{{apiKey}}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/locale/countries/eu");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-appwrite-jwt: {{apiKey}}");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/locale/countries/eu" {:headers {:x-appwrite-jwt "{{apiKey}}"}})
require "http/client"
url = "{{baseUrl}}/locale/countries/eu"
headers = HTTP::Headers{
"x-appwrite-jwt" => "{{apiKey}}"
}
response = HTTP::Client.get url, headers: headers
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/locale/countries/eu"),
Headers =
{
{ "x-appwrite-jwt", "{{apiKey}}" },
},
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/locale/countries/eu");
var request = new RestRequest("", Method.Get);
request.AddHeader("x-appwrite-jwt", "{{apiKey}}");
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/locale/countries/eu"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-appwrite-jwt", "{{apiKey}}")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/locale/countries/eu HTTP/1.1
X-Appwrite-Jwt: {{apiKey}}
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/locale/countries/eu")
.setHeader("x-appwrite-jwt", "{{apiKey}}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/locale/countries/eu"))
.header("x-appwrite-jwt", "{{apiKey}}")
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/locale/countries/eu")
.get()
.addHeader("x-appwrite-jwt", "{{apiKey}}")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/locale/countries/eu")
.header("x-appwrite-jwt", "{{apiKey}}")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/locale/countries/eu');
xhr.setRequestHeader('x-appwrite-jwt', '{{apiKey}}');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/locale/countries/eu',
headers: {'x-appwrite-jwt': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/locale/countries/eu';
const options = {method: 'GET', headers: {'x-appwrite-jwt': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/locale/countries/eu',
method: 'GET',
headers: {
'x-appwrite-jwt': '{{apiKey}}'
}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/locale/countries/eu")
.get()
.addHeader("x-appwrite-jwt", "{{apiKey}}")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/locale/countries/eu',
headers: {
'x-appwrite-jwt': '{{apiKey}}'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/locale/countries/eu',
headers: {'x-appwrite-jwt': '{{apiKey}}'}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/locale/countries/eu');
req.headers({
'x-appwrite-jwt': '{{apiKey}}'
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/locale/countries/eu',
headers: {'x-appwrite-jwt': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/locale/countries/eu';
const options = {method: 'GET', headers: {'x-appwrite-jwt': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-appwrite-jwt": @"{{apiKey}}" };
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/locale/countries/eu"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
[request setAllHTTPHeaderFields:headers];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/locale/countries/eu" in
let headers = Header.add (Header.init ()) "x-appwrite-jwt" "{{apiKey}}" in
Client.call ~headers `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/locale/countries/eu",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-appwrite-jwt: {{apiKey}}"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/locale/countries/eu', [
'headers' => [
'x-appwrite-jwt' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/locale/countries/eu');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders([
'x-appwrite-jwt' => '{{apiKey}}'
]);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/locale/countries/eu');
$request->setRequestMethod('GET');
$request->setHeaders([
'x-appwrite-jwt' => '{{apiKey}}'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-appwrite-jwt", "{{apiKey}}")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/locale/countries/eu' -Method GET -Headers $headers
$headers=@{}
$headers.Add("x-appwrite-jwt", "{{apiKey}}")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/locale/countries/eu' -Method GET -Headers $headers
import http.client
conn = http.client.HTTPSConnection("example.com")
headers = { 'x-appwrite-jwt': "{{apiKey}}" }
conn.request("GET", "/baseUrl/locale/countries/eu", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/locale/countries/eu"
headers = {"x-appwrite-jwt": "{{apiKey}}"}
response = requests.get(url, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/locale/countries/eu"
response <- VERB("GET", url, add_headers('x-appwrite-jwt' = '{{apiKey}}'), content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/locale/countries/eu")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-appwrite-jwt"] = '{{apiKey}}'
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/locale/countries/eu') do |req|
req.headers['x-appwrite-jwt'] = '{{apiKey}}'
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/locale/countries/eu";
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-appwrite-jwt", "{{apiKey}}".parse().unwrap());
let client = reqwest::Client::new();
let response = client.get(url)
.headers(headers)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/locale/countries/eu \
--header 'x-appwrite-jwt: {{apiKey}}'
http GET {{baseUrl}}/locale/countries/eu \
x-appwrite-jwt:'{{apiKey}}'
wget --quiet \
--method GET \
--header 'x-appwrite-jwt: {{apiKey}}' \
--output-document \
- {{baseUrl}}/locale/countries/eu
import Foundation
let headers = ["x-appwrite-jwt": "{{apiKey}}"]
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/locale/countries/eu")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
List Languages
{{baseUrl}}/locale/languages
HEADERS
X-Appwrite-JWT
{{apiKey}}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/locale/languages");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-appwrite-jwt: {{apiKey}}");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/locale/languages" {:headers {:x-appwrite-jwt "{{apiKey}}"}})
require "http/client"
url = "{{baseUrl}}/locale/languages"
headers = HTTP::Headers{
"x-appwrite-jwt" => "{{apiKey}}"
}
response = HTTP::Client.get url, headers: headers
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/locale/languages"),
Headers =
{
{ "x-appwrite-jwt", "{{apiKey}}" },
},
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/locale/languages");
var request = new RestRequest("", Method.Get);
request.AddHeader("x-appwrite-jwt", "{{apiKey}}");
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/locale/languages"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-appwrite-jwt", "{{apiKey}}")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/locale/languages HTTP/1.1
X-Appwrite-Jwt: {{apiKey}}
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/locale/languages")
.setHeader("x-appwrite-jwt", "{{apiKey}}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/locale/languages"))
.header("x-appwrite-jwt", "{{apiKey}}")
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/locale/languages")
.get()
.addHeader("x-appwrite-jwt", "{{apiKey}}")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/locale/languages")
.header("x-appwrite-jwt", "{{apiKey}}")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/locale/languages');
xhr.setRequestHeader('x-appwrite-jwt', '{{apiKey}}');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/locale/languages',
headers: {'x-appwrite-jwt': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/locale/languages';
const options = {method: 'GET', headers: {'x-appwrite-jwt': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/locale/languages',
method: 'GET',
headers: {
'x-appwrite-jwt': '{{apiKey}}'
}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/locale/languages")
.get()
.addHeader("x-appwrite-jwt", "{{apiKey}}")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/locale/languages',
headers: {
'x-appwrite-jwt': '{{apiKey}}'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/locale/languages',
headers: {'x-appwrite-jwt': '{{apiKey}}'}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/locale/languages');
req.headers({
'x-appwrite-jwt': '{{apiKey}}'
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/locale/languages',
headers: {'x-appwrite-jwt': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/locale/languages';
const options = {method: 'GET', headers: {'x-appwrite-jwt': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-appwrite-jwt": @"{{apiKey}}" };
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/locale/languages"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
[request setAllHTTPHeaderFields:headers];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/locale/languages" in
let headers = Header.add (Header.init ()) "x-appwrite-jwt" "{{apiKey}}" in
Client.call ~headers `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/locale/languages",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-appwrite-jwt: {{apiKey}}"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/locale/languages', [
'headers' => [
'x-appwrite-jwt' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/locale/languages');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders([
'x-appwrite-jwt' => '{{apiKey}}'
]);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/locale/languages');
$request->setRequestMethod('GET');
$request->setHeaders([
'x-appwrite-jwt' => '{{apiKey}}'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-appwrite-jwt", "{{apiKey}}")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/locale/languages' -Method GET -Headers $headers
$headers=@{}
$headers.Add("x-appwrite-jwt", "{{apiKey}}")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/locale/languages' -Method GET -Headers $headers
import http.client
conn = http.client.HTTPSConnection("example.com")
headers = { 'x-appwrite-jwt': "{{apiKey}}" }
conn.request("GET", "/baseUrl/locale/languages", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/locale/languages"
headers = {"x-appwrite-jwt": "{{apiKey}}"}
response = requests.get(url, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/locale/languages"
response <- VERB("GET", url, add_headers('x-appwrite-jwt' = '{{apiKey}}'), content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/locale/languages")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-appwrite-jwt"] = '{{apiKey}}'
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/locale/languages') do |req|
req.headers['x-appwrite-jwt'] = '{{apiKey}}'
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/locale/languages";
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-appwrite-jwt", "{{apiKey}}".parse().unwrap());
let client = reqwest::Client::new();
let response = client.get(url)
.headers(headers)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/locale/languages \
--header 'x-appwrite-jwt: {{apiKey}}'
http GET {{baseUrl}}/locale/languages \
x-appwrite-jwt:'{{apiKey}}'
wget --quiet \
--method GET \
--header 'x-appwrite-jwt: {{apiKey}}' \
--output-document \
- {{baseUrl}}/locale/languages
import Foundation
let headers = ["x-appwrite-jwt": "{{apiKey}}"]
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/locale/languages")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
Create File
{{baseUrl}}/storage/files
HEADERS
X-Appwrite-JWT
{{apiKey}}
BODY multipartForm
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/storage/files");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-appwrite-jwt: {{apiKey}}");
headers = curl_slist_append(headers, "content-type: multipart/form-data; boundary=---011000010111000001101001");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"read\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"write\"\r\n\r\n\r\n-----011000010111000001101001--\r\n");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/storage/files" {:headers {:x-appwrite-jwt "{{apiKey}}"}
:multipart [{:name "file"
:content ""} {:name "read"
:content ""} {:name "write"
:content ""}]})
require "http/client"
url = "{{baseUrl}}/storage/files"
headers = HTTP::Headers{
"x-appwrite-jwt" => "{{apiKey}}"
"content-type" => "multipart/form-data; boundary=---011000010111000001101001"
}
reqBody = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"read\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"write\"\r\n\r\n\r\n-----011000010111000001101001--\r\n"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/storage/files"),
Headers =
{
{ "x-appwrite-jwt", "{{apiKey}}" },
},
Content = new MultipartFormDataContent
{
new StringContent("")
{
Headers =
{
ContentDisposition = new ContentDispositionHeaderValue("form-data")
{
Name = "file",
}
}
},
new StringContent("")
{
Headers =
{
ContentDisposition = new ContentDispositionHeaderValue("form-data")
{
Name = "read",
}
}
},
new StringContent("")
{
Headers =
{
ContentDisposition = new ContentDispositionHeaderValue("form-data")
{
Name = "write",
}
}
},
},
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/storage/files");
var request = new RestRequest("", Method.Post);
request.AddHeader("x-appwrite-jwt", "{{apiKey}}");
request.AddHeader("content-type", "multipart/form-data; boundary=---011000010111000001101001");
request.AddParameter("multipart/form-data; boundary=---011000010111000001101001", "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"read\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"write\"\r\n\r\n\r\n-----011000010111000001101001--\r\n", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/storage/files"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"read\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"write\"\r\n\r\n\r\n-----011000010111000001101001--\r\n")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-appwrite-jwt", "{{apiKey}}")
req.Header.Add("content-type", "multipart/form-data; boundary=---011000010111000001101001")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/storage/files HTTP/1.1
X-Appwrite-Jwt: {{apiKey}}
Content-Type: multipart/form-data; boundary=---011000010111000001101001
Host: example.com
Content-Length: 274
-----011000010111000001101001
Content-Disposition: form-data; name="file"
-----011000010111000001101001
Content-Disposition: form-data; name="read"
-----011000010111000001101001
Content-Disposition: form-data; name="write"
-----011000010111000001101001--
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/storage/files")
.setHeader("x-appwrite-jwt", "{{apiKey}}")
.setHeader("content-type", "multipart/form-data; boundary=---011000010111000001101001")
.setBody("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"read\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"write\"\r\n\r\n\r\n-----011000010111000001101001--\r\n")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/storage/files"))
.header("x-appwrite-jwt", "{{apiKey}}")
.header("content-type", "multipart/form-data; boundary=---011000010111000001101001")
.method("POST", HttpRequest.BodyPublishers.ofString("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"read\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"write\"\r\n\r\n\r\n-----011000010111000001101001--\r\n"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("multipart/form-data; boundary=---011000010111000001101001");
RequestBody body = RequestBody.create(mediaType, "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"read\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"write\"\r\n\r\n\r\n-----011000010111000001101001--\r\n");
Request request = new Request.Builder()
.url("{{baseUrl}}/storage/files")
.post(body)
.addHeader("x-appwrite-jwt", "{{apiKey}}")
.addHeader("content-type", "multipart/form-data; boundary=---011000010111000001101001")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/storage/files")
.header("x-appwrite-jwt", "{{apiKey}}")
.header("content-type", "multipart/form-data; boundary=---011000010111000001101001")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"read\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"write\"\r\n\r\n\r\n-----011000010111000001101001--\r\n")
.asString();
const data = new FormData();
data.append('file', '');
data.append('read', '');
data.append('write', '');
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/storage/files');
xhr.setRequestHeader('x-appwrite-jwt', '{{apiKey}}');
xhr.send(data);
import axios from 'axios';
const form = new FormData();
form.append('file', '');
form.append('read', '');
form.append('write', '');
const options = {
method: 'POST',
url: '{{baseUrl}}/storage/files',
headers: {
'x-appwrite-jwt': '{{apiKey}}',
'content-type': 'multipart/form-data; boundary=---011000010111000001101001'
},
data: '[form]'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/storage/files';
const form = new FormData();
form.append('file', '');
form.append('read', '');
form.append('write', '');
const options = {method: 'POST', headers: {'x-appwrite-jwt': '{{apiKey}}'}};
options.body = form;
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const form = new FormData();
form.append('file', '');
form.append('read', '');
form.append('write', '');
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/storage/files',
method: 'POST',
headers: {
'x-appwrite-jwt': '{{apiKey}}'
},
processData: false,
contentType: false,
mimeType: 'multipart/form-data',
data: form
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("multipart/form-data; boundary=---011000010111000001101001")
val body = RequestBody.create(mediaType, "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"read\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"write\"\r\n\r\n\r\n-----011000010111000001101001--\r\n")
val request = Request.Builder()
.url("{{baseUrl}}/storage/files")
.post(body)
.addHeader("x-appwrite-jwt", "{{apiKey}}")
.addHeader("content-type", "multipart/form-data; boundary=---011000010111000001101001")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/storage/files',
headers: {
'x-appwrite-jwt': '{{apiKey}}',
'content-type': 'multipart/form-data; boundary=---011000010111000001101001'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write('-----011000010111000001101001\r\nContent-Disposition: form-data; name="file"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name="read"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name="write"\r\n\r\n\r\n-----011000010111000001101001--\r\n');
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/storage/files',
headers: {
'x-appwrite-jwt': '{{apiKey}}',
'content-type': 'multipart/form-data; boundary=---011000010111000001101001'
},
formData: {file: '', read: '', write: ''}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/storage/files');
req.headers({
'x-appwrite-jwt': '{{apiKey}}',
'content-type': 'multipart/form-data; boundary=---011000010111000001101001'
});
req.multipart([]);
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/storage/files',
headers: {
'x-appwrite-jwt': '{{apiKey}}',
'content-type': 'multipart/form-data; boundary=---011000010111000001101001'
},
data: '-----011000010111000001101001\r\nContent-Disposition: form-data; name="file"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name="read"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name="write"\r\n\r\n\r\n-----011000010111000001101001--\r\n'
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const FormData = require('form-data');
const fetch = require('node-fetch');
const formData = new FormData();
formData.append('file', '');
formData.append('read', '');
formData.append('write', '');
const url = '{{baseUrl}}/storage/files';
const options = {method: 'POST', headers: {'x-appwrite-jwt': '{{apiKey}}'}};
options.body = formData;
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-appwrite-jwt": @"{{apiKey}}",
@"content-type": @"multipart/form-data; boundary=---011000010111000001101001" };
NSArray *parameters = @[ @{ @"name": @"file", @"value": @"" },
@{ @"name": @"read", @"value": @"" },
@{ @"name": @"write", @"value": @"" } ];
NSString *boundary = @"---011000010111000001101001";
NSError *error;
NSMutableString *body = [NSMutableString string];
for (NSDictionary *param in parameters) {
[body appendFormat:@"--%@\r\n", boundary];
if (param[@"fileName"]) {
[body appendFormat:@"Content-Disposition:form-data; name=\"%@\"; filename=\"%@\"\r\n", param[@"name"], param[@"fileName"]];
[body appendFormat:@"Content-Type: %@\r\n\r\n", param[@"contentType"]];
[body appendFormat:@"%@", [NSString stringWithContentsOfFile:param[@"fileName"] encoding:NSUTF8StringEncoding error:&error]];
if (error) {
NSLog(@"%@", error);
}
} else {
[body appendFormat:@"Content-Disposition:form-data; name=\"%@\"\r\n\r\n", param[@"name"]];
[body appendFormat:@"%@", param[@"value"]];
}
}
[body appendFormat:@"\r\n--%@--\r\n", boundary];
NSData *postData = [body dataUsingEncoding:NSUTF8StringEncoding];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/storage/files"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/storage/files" in
let headers = Header.add_list (Header.init ()) [
("x-appwrite-jwt", "{{apiKey}}");
("content-type", "multipart/form-data; boundary=---011000010111000001101001");
] in
let body = Cohttp_lwt_body.of_string "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"read\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"write\"\r\n\r\n\r\n-----011000010111000001101001--\r\n" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/storage/files",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"read\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"write\"\r\n\r\n\r\n-----011000010111000001101001--\r\n",
CURLOPT_HTTPHEADER => [
"content-type: multipart/form-data; boundary=---011000010111000001101001",
"x-appwrite-jwt: {{apiKey}}"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/storage/files', [
'headers' => [
'content-type' => 'multipart/form-data; boundary=---011000010111000001101001',
'x-appwrite-jwt' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/storage/files');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'x-appwrite-jwt' => '{{apiKey}}',
'content-type' => 'multipart/form-data; boundary=---011000010111000001101001'
]);
$request->setBody('-----011000010111000001101001
Content-Disposition: form-data; name="file"
-----011000010111000001101001
Content-Disposition: form-data; name="read"
-----011000010111000001101001
Content-Disposition: form-data; name="write"
-----011000010111000001101001--
');
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
addForm(null, null);
$request->setRequestUrl('{{baseUrl}}/storage/files');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'x-appwrite-jwt' => '{{apiKey}}'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-appwrite-jwt", "{{apiKey}}")
$headers.Add("content-type", "multipart/form-data; boundary=---011000010111000001101001")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/storage/files' -Method POST -Headers $headers -ContentType 'multipart/form-data; boundary=---011000010111000001101001' -Body '-----011000010111000001101001
Content-Disposition: form-data; name="file"
-----011000010111000001101001
Content-Disposition: form-data; name="read"
-----011000010111000001101001
Content-Disposition: form-data; name="write"
-----011000010111000001101001--
'
$headers=@{}
$headers.Add("x-appwrite-jwt", "{{apiKey}}")
$headers.Add("content-type", "multipart/form-data; boundary=---011000010111000001101001")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/storage/files' -Method POST -Headers $headers -ContentType 'multipart/form-data; boundary=---011000010111000001101001' -Body '-----011000010111000001101001
Content-Disposition: form-data; name="file"
-----011000010111000001101001
Content-Disposition: form-data; name="read"
-----011000010111000001101001
Content-Disposition: form-data; name="write"
-----011000010111000001101001--
'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"read\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"write\"\r\n\r\n\r\n-----011000010111000001101001--\r\n"
headers = {
'x-appwrite-jwt': "{{apiKey}}",
'content-type': "multipart/form-data; boundary=---011000010111000001101001"
}
conn.request("POST", "/baseUrl/storage/files", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/storage/files"
payload = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"read\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"write\"\r\n\r\n\r\n-----011000010111000001101001--\r\n"
headers = {
"x-appwrite-jwt": "{{apiKey}}",
"content-type": "multipart/form-data; boundary=---011000010111000001101001"
}
response = requests.post(url, data=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/storage/files"
payload <- "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"read\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"write\"\r\n\r\n\r\n-----011000010111000001101001--\r\n"
encode <- "multipart"
response <- VERB("POST", url, body = payload, add_headers('x-appwrite-jwt' = '{{apiKey}}'), content_type("multipart/form-data"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/storage/files")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-appwrite-jwt"] = '{{apiKey}}'
request["content-type"] = 'multipart/form-data; boundary=---011000010111000001101001'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"read\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"write\"\r\n\r\n\r\n-----011000010111000001101001--\r\n"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'multipart/form-data; boundary=---011000010111000001101001'}
)
response = conn.post('/baseUrl/storage/files') do |req|
req.headers['x-appwrite-jwt'] = '{{apiKey}}'
req.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"read\"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"write\"\r\n\r\n\r\n-----011000010111000001101001--\r\n"
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/storage/files";
let form = reqwest::multipart::Form::new()
.text("file", "")
.text("read", "")
.text("write", "");
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-appwrite-jwt", "{{apiKey}}".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.multipart(form)
.headers(headers)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/storage/files \
--header 'content-type: multipart/form-data' \
--header 'x-appwrite-jwt: {{apiKey}}' \
--form file= \
--form read= \
--form write=
echo '-----011000010111000001101001
Content-Disposition: form-data; name="file"
-----011000010111000001101001
Content-Disposition: form-data; name="read"
-----011000010111000001101001
Content-Disposition: form-data; name="write"
-----011000010111000001101001--
' | \
http POST {{baseUrl}}/storage/files \
content-type:'multipart/form-data; boundary=---011000010111000001101001' \
x-appwrite-jwt:'{{apiKey}}'
wget --quiet \
--method POST \
--header 'x-appwrite-jwt: {{apiKey}}' \
--header 'content-type: multipart/form-data; boundary=---011000010111000001101001' \
--body-data '-----011000010111000001101001\r\nContent-Disposition: form-data; name="file"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name="read"\r\n\r\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name="write"\r\n\r\n\r\n-----011000010111000001101001--\r\n' \
--output-document \
- {{baseUrl}}/storage/files
import Foundation
let headers = [
"x-appwrite-jwt": "{{apiKey}}",
"content-type": "multipart/form-data; boundary=---011000010111000001101001"
]
let parameters = [
[
"name": "file",
"value": ""
],
[
"name": "read",
"value": ""
],
[
"name": "write",
"value": ""
]
]
let boundary = "---011000010111000001101001"
var body = ""
var error: NSError? = nil
for param in parameters {
let paramName = param["name"]!
body += "--\(boundary)\r\n"
body += "Content-Disposition:form-data; name=\"\(paramName)\""
if let filename = param["fileName"] {
let contentType = param["content-type"]!
let fileContent = String(contentsOfFile: filename, encoding: String.Encoding.utf8)
if (error != nil) {
print(error as Any)
}
body += "; filename=\"\(filename)\"\r\n"
body += "Content-Type: \(contentType)\r\n\r\n"
body += fileContent
} else if let paramValue = param["value"] {
body += "\r\n\r\n\(paramValue)"
}
}
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/storage/files")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
DELETE
Delete File
{{baseUrl}}/storage/files/:fileId
HEADERS
X-Appwrite-JWT
{{apiKey}}
QUERY PARAMS
fileId
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/storage/files/:fileId");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-appwrite-jwt: {{apiKey}}");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/storage/files/:fileId" {:headers {:x-appwrite-jwt "{{apiKey}}"}})
require "http/client"
url = "{{baseUrl}}/storage/files/:fileId"
headers = HTTP::Headers{
"x-appwrite-jwt" => "{{apiKey}}"
}
response = HTTP::Client.delete url, headers: headers
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Delete,
RequestUri = new Uri("{{baseUrl}}/storage/files/:fileId"),
Headers =
{
{ "x-appwrite-jwt", "{{apiKey}}" },
},
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/storage/files/:fileId");
var request = new RestRequest("", Method.Delete);
request.AddHeader("x-appwrite-jwt", "{{apiKey}}");
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/storage/files/:fileId"
req, _ := http.NewRequest("DELETE", url, nil)
req.Header.Add("x-appwrite-jwt", "{{apiKey}}")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
DELETE /baseUrl/storage/files/:fileId HTTP/1.1
X-Appwrite-Jwt: {{apiKey}}
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/storage/files/:fileId")
.setHeader("x-appwrite-jwt", "{{apiKey}}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/storage/files/:fileId"))
.header("x-appwrite-jwt", "{{apiKey}}")
.method("DELETE", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/storage/files/:fileId")
.delete(null)
.addHeader("x-appwrite-jwt", "{{apiKey}}")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/storage/files/:fileId")
.header("x-appwrite-jwt", "{{apiKey}}")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('DELETE', '{{baseUrl}}/storage/files/:fileId');
xhr.setRequestHeader('x-appwrite-jwt', '{{apiKey}}');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'DELETE',
url: '{{baseUrl}}/storage/files/:fileId',
headers: {'x-appwrite-jwt': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/storage/files/:fileId';
const options = {method: 'DELETE', headers: {'x-appwrite-jwt': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/storage/files/:fileId',
method: 'DELETE',
headers: {
'x-appwrite-jwt': '{{apiKey}}'
}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/storage/files/:fileId")
.delete(null)
.addHeader("x-appwrite-jwt", "{{apiKey}}")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'DELETE',
hostname: 'example.com',
port: null,
path: '/baseUrl/storage/files/:fileId',
headers: {
'x-appwrite-jwt': '{{apiKey}}'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'DELETE',
url: '{{baseUrl}}/storage/files/:fileId',
headers: {'x-appwrite-jwt': '{{apiKey}}'}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('DELETE', '{{baseUrl}}/storage/files/:fileId');
req.headers({
'x-appwrite-jwt': '{{apiKey}}'
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'DELETE',
url: '{{baseUrl}}/storage/files/:fileId',
headers: {'x-appwrite-jwt': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/storage/files/:fileId';
const options = {method: 'DELETE', headers: {'x-appwrite-jwt': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-appwrite-jwt": @"{{apiKey}}" };
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/storage/files/:fileId"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"DELETE"];
[request setAllHTTPHeaderFields:headers];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/storage/files/:fileId" in
let headers = Header.add (Header.init ()) "x-appwrite-jwt" "{{apiKey}}" in
Client.call ~headers `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/storage/files/:fileId",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_HTTPHEADER => [
"x-appwrite-jwt: {{apiKey}}"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('DELETE', '{{baseUrl}}/storage/files/:fileId', [
'headers' => [
'x-appwrite-jwt' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/storage/files/:fileId');
$request->setMethod(HTTP_METH_DELETE);
$request->setHeaders([
'x-appwrite-jwt' => '{{apiKey}}'
]);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/storage/files/:fileId');
$request->setRequestMethod('DELETE');
$request->setHeaders([
'x-appwrite-jwt' => '{{apiKey}}'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-appwrite-jwt", "{{apiKey}}")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/storage/files/:fileId' -Method DELETE -Headers $headers
$headers=@{}
$headers.Add("x-appwrite-jwt", "{{apiKey}}")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/storage/files/:fileId' -Method DELETE -Headers $headers
import http.client
conn = http.client.HTTPSConnection("example.com")
headers = { 'x-appwrite-jwt': "{{apiKey}}" }
conn.request("DELETE", "/baseUrl/storage/files/:fileId", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/storage/files/:fileId"
headers = {"x-appwrite-jwt": "{{apiKey}}"}
response = requests.delete(url, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/storage/files/:fileId"
response <- VERB("DELETE", url, add_headers('x-appwrite-jwt' = '{{apiKey}}'), content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/storage/files/:fileId")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["x-appwrite-jwt"] = '{{apiKey}}'
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.delete('/baseUrl/storage/files/:fileId') do |req|
req.headers['x-appwrite-jwt'] = '{{apiKey}}'
end
puts response.status
puts response.body
use std::str::FromStr;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/storage/files/:fileId";
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-appwrite-jwt", "{{apiKey}}".parse().unwrap());
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("DELETE").unwrap(), url)
.headers(headers)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request DELETE \
--url {{baseUrl}}/storage/files/:fileId \
--header 'x-appwrite-jwt: {{apiKey}}'
http DELETE {{baseUrl}}/storage/files/:fileId \
x-appwrite-jwt:'{{apiKey}}'
wget --quiet \
--method DELETE \
--header 'x-appwrite-jwt: {{apiKey}}' \
--output-document \
- {{baseUrl}}/storage/files/:fileId
import Foundation
let headers = ["x-appwrite-jwt": "{{apiKey}}"]
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/storage/files/:fileId")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "DELETE"
request.allHTTPHeaderFields = headers
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
Get File Preview
{{baseUrl}}/storage/files/:fileId/preview
HEADERS
X-Appwrite-JWT
{{apiKey}}
QUERY PARAMS
fileId
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/storage/files/:fileId/preview");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-appwrite-jwt: {{apiKey}}");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/storage/files/:fileId/preview" {:headers {:x-appwrite-jwt "{{apiKey}}"}})
require "http/client"
url = "{{baseUrl}}/storage/files/:fileId/preview"
headers = HTTP::Headers{
"x-appwrite-jwt" => "{{apiKey}}"
}
response = HTTP::Client.get url, headers: headers
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/storage/files/:fileId/preview"),
Headers =
{
{ "x-appwrite-jwt", "{{apiKey}}" },
},
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/storage/files/:fileId/preview");
var request = new RestRequest("", Method.Get);
request.AddHeader("x-appwrite-jwt", "{{apiKey}}");
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/storage/files/:fileId/preview"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-appwrite-jwt", "{{apiKey}}")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/storage/files/:fileId/preview HTTP/1.1
X-Appwrite-Jwt: {{apiKey}}
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/storage/files/:fileId/preview")
.setHeader("x-appwrite-jwt", "{{apiKey}}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/storage/files/:fileId/preview"))
.header("x-appwrite-jwt", "{{apiKey}}")
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/storage/files/:fileId/preview")
.get()
.addHeader("x-appwrite-jwt", "{{apiKey}}")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/storage/files/:fileId/preview")
.header("x-appwrite-jwt", "{{apiKey}}")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/storage/files/:fileId/preview');
xhr.setRequestHeader('x-appwrite-jwt', '{{apiKey}}');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/storage/files/:fileId/preview',
headers: {'x-appwrite-jwt': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/storage/files/:fileId/preview';
const options = {method: 'GET', headers: {'x-appwrite-jwt': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/storage/files/:fileId/preview',
method: 'GET',
headers: {
'x-appwrite-jwt': '{{apiKey}}'
}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/storage/files/:fileId/preview")
.get()
.addHeader("x-appwrite-jwt", "{{apiKey}}")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/storage/files/:fileId/preview',
headers: {
'x-appwrite-jwt': '{{apiKey}}'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/storage/files/:fileId/preview',
headers: {'x-appwrite-jwt': '{{apiKey}}'}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/storage/files/:fileId/preview');
req.headers({
'x-appwrite-jwt': '{{apiKey}}'
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/storage/files/:fileId/preview',
headers: {'x-appwrite-jwt': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/storage/files/:fileId/preview';
const options = {method: 'GET', headers: {'x-appwrite-jwt': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-appwrite-jwt": @"{{apiKey}}" };
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/storage/files/:fileId/preview"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
[request setAllHTTPHeaderFields:headers];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/storage/files/:fileId/preview" in
let headers = Header.add (Header.init ()) "x-appwrite-jwt" "{{apiKey}}" in
Client.call ~headers `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/storage/files/:fileId/preview",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-appwrite-jwt: {{apiKey}}"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/storage/files/:fileId/preview', [
'headers' => [
'x-appwrite-jwt' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/storage/files/:fileId/preview');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders([
'x-appwrite-jwt' => '{{apiKey}}'
]);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/storage/files/:fileId/preview');
$request->setRequestMethod('GET');
$request->setHeaders([
'x-appwrite-jwt' => '{{apiKey}}'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-appwrite-jwt", "{{apiKey}}")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/storage/files/:fileId/preview' -Method GET -Headers $headers
$headers=@{}
$headers.Add("x-appwrite-jwt", "{{apiKey}}")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/storage/files/:fileId/preview' -Method GET -Headers $headers
import http.client
conn = http.client.HTTPSConnection("example.com")
headers = { 'x-appwrite-jwt': "{{apiKey}}" }
conn.request("GET", "/baseUrl/storage/files/:fileId/preview", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/storage/files/:fileId/preview"
headers = {"x-appwrite-jwt": "{{apiKey}}"}
response = requests.get(url, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/storage/files/:fileId/preview"
response <- VERB("GET", url, add_headers('x-appwrite-jwt' = '{{apiKey}}'), content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/storage/files/:fileId/preview")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-appwrite-jwt"] = '{{apiKey}}'
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/storage/files/:fileId/preview') do |req|
req.headers['x-appwrite-jwt'] = '{{apiKey}}'
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/storage/files/:fileId/preview";
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-appwrite-jwt", "{{apiKey}}".parse().unwrap());
let client = reqwest::Client::new();
let response = client.get(url)
.headers(headers)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/storage/files/:fileId/preview \
--header 'x-appwrite-jwt: {{apiKey}}'
http GET {{baseUrl}}/storage/files/:fileId/preview \
x-appwrite-jwt:'{{apiKey}}'
wget --quiet \
--method GET \
--header 'x-appwrite-jwt: {{apiKey}}' \
--output-document \
- {{baseUrl}}/storage/files/:fileId/preview
import Foundation
let headers = ["x-appwrite-jwt": "{{apiKey}}"]
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/storage/files/:fileId/preview")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
Get File for Download
{{baseUrl}}/storage/files/:fileId/download
HEADERS
X-Appwrite-JWT
{{apiKey}}
QUERY PARAMS
fileId
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/storage/files/:fileId/download");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-appwrite-jwt: {{apiKey}}");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/storage/files/:fileId/download" {:headers {:x-appwrite-jwt "{{apiKey}}"}})
require "http/client"
url = "{{baseUrl}}/storage/files/:fileId/download"
headers = HTTP::Headers{
"x-appwrite-jwt" => "{{apiKey}}"
}
response = HTTP::Client.get url, headers: headers
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/storage/files/:fileId/download"),
Headers =
{
{ "x-appwrite-jwt", "{{apiKey}}" },
},
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/storage/files/:fileId/download");
var request = new RestRequest("", Method.Get);
request.AddHeader("x-appwrite-jwt", "{{apiKey}}");
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/storage/files/:fileId/download"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-appwrite-jwt", "{{apiKey}}")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/storage/files/:fileId/download HTTP/1.1
X-Appwrite-Jwt: {{apiKey}}
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/storage/files/:fileId/download")
.setHeader("x-appwrite-jwt", "{{apiKey}}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/storage/files/:fileId/download"))
.header("x-appwrite-jwt", "{{apiKey}}")
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/storage/files/:fileId/download")
.get()
.addHeader("x-appwrite-jwt", "{{apiKey}}")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/storage/files/:fileId/download")
.header("x-appwrite-jwt", "{{apiKey}}")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/storage/files/:fileId/download');
xhr.setRequestHeader('x-appwrite-jwt', '{{apiKey}}');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/storage/files/:fileId/download',
headers: {'x-appwrite-jwt': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/storage/files/:fileId/download';
const options = {method: 'GET', headers: {'x-appwrite-jwt': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/storage/files/:fileId/download',
method: 'GET',
headers: {
'x-appwrite-jwt': '{{apiKey}}'
}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/storage/files/:fileId/download")
.get()
.addHeader("x-appwrite-jwt", "{{apiKey}}")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/storage/files/:fileId/download',
headers: {
'x-appwrite-jwt': '{{apiKey}}'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/storage/files/:fileId/download',
headers: {'x-appwrite-jwt': '{{apiKey}}'}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/storage/files/:fileId/download');
req.headers({
'x-appwrite-jwt': '{{apiKey}}'
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/storage/files/:fileId/download',
headers: {'x-appwrite-jwt': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/storage/files/:fileId/download';
const options = {method: 'GET', headers: {'x-appwrite-jwt': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-appwrite-jwt": @"{{apiKey}}" };
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/storage/files/:fileId/download"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
[request setAllHTTPHeaderFields:headers];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/storage/files/:fileId/download" in
let headers = Header.add (Header.init ()) "x-appwrite-jwt" "{{apiKey}}" in
Client.call ~headers `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/storage/files/:fileId/download",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-appwrite-jwt: {{apiKey}}"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/storage/files/:fileId/download', [
'headers' => [
'x-appwrite-jwt' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/storage/files/:fileId/download');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders([
'x-appwrite-jwt' => '{{apiKey}}'
]);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/storage/files/:fileId/download');
$request->setRequestMethod('GET');
$request->setHeaders([
'x-appwrite-jwt' => '{{apiKey}}'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-appwrite-jwt", "{{apiKey}}")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/storage/files/:fileId/download' -Method GET -Headers $headers
$headers=@{}
$headers.Add("x-appwrite-jwt", "{{apiKey}}")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/storage/files/:fileId/download' -Method GET -Headers $headers
import http.client
conn = http.client.HTTPSConnection("example.com")
headers = { 'x-appwrite-jwt': "{{apiKey}}" }
conn.request("GET", "/baseUrl/storage/files/:fileId/download", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/storage/files/:fileId/download"
headers = {"x-appwrite-jwt": "{{apiKey}}"}
response = requests.get(url, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/storage/files/:fileId/download"
response <- VERB("GET", url, add_headers('x-appwrite-jwt' = '{{apiKey}}'), content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/storage/files/:fileId/download")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-appwrite-jwt"] = '{{apiKey}}'
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/storage/files/:fileId/download') do |req|
req.headers['x-appwrite-jwt'] = '{{apiKey}}'
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/storage/files/:fileId/download";
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-appwrite-jwt", "{{apiKey}}".parse().unwrap());
let client = reqwest::Client::new();
let response = client.get(url)
.headers(headers)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/storage/files/:fileId/download \
--header 'x-appwrite-jwt: {{apiKey}}'
http GET {{baseUrl}}/storage/files/:fileId/download \
x-appwrite-jwt:'{{apiKey}}'
wget --quiet \
--method GET \
--header 'x-appwrite-jwt: {{apiKey}}' \
--output-document \
- {{baseUrl}}/storage/files/:fileId/download
import Foundation
let headers = ["x-appwrite-jwt": "{{apiKey}}"]
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/storage/files/:fileId/download")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
Get File for View
{{baseUrl}}/storage/files/:fileId/view
HEADERS
X-Appwrite-JWT
{{apiKey}}
QUERY PARAMS
fileId
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/storage/files/:fileId/view");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-appwrite-jwt: {{apiKey}}");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/storage/files/:fileId/view" {:headers {:x-appwrite-jwt "{{apiKey}}"}})
require "http/client"
url = "{{baseUrl}}/storage/files/:fileId/view"
headers = HTTP::Headers{
"x-appwrite-jwt" => "{{apiKey}}"
}
response = HTTP::Client.get url, headers: headers
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/storage/files/:fileId/view"),
Headers =
{
{ "x-appwrite-jwt", "{{apiKey}}" },
},
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/storage/files/:fileId/view");
var request = new RestRequest("", Method.Get);
request.AddHeader("x-appwrite-jwt", "{{apiKey}}");
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/storage/files/:fileId/view"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-appwrite-jwt", "{{apiKey}}")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/storage/files/:fileId/view HTTP/1.1
X-Appwrite-Jwt: {{apiKey}}
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/storage/files/:fileId/view")
.setHeader("x-appwrite-jwt", "{{apiKey}}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/storage/files/:fileId/view"))
.header("x-appwrite-jwt", "{{apiKey}}")
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/storage/files/:fileId/view")
.get()
.addHeader("x-appwrite-jwt", "{{apiKey}}")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/storage/files/:fileId/view")
.header("x-appwrite-jwt", "{{apiKey}}")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/storage/files/:fileId/view');
xhr.setRequestHeader('x-appwrite-jwt', '{{apiKey}}');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/storage/files/:fileId/view',
headers: {'x-appwrite-jwt': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/storage/files/:fileId/view';
const options = {method: 'GET', headers: {'x-appwrite-jwt': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/storage/files/:fileId/view',
method: 'GET',
headers: {
'x-appwrite-jwt': '{{apiKey}}'
}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/storage/files/:fileId/view")
.get()
.addHeader("x-appwrite-jwt", "{{apiKey}}")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/storage/files/:fileId/view',
headers: {
'x-appwrite-jwt': '{{apiKey}}'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/storage/files/:fileId/view',
headers: {'x-appwrite-jwt': '{{apiKey}}'}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/storage/files/:fileId/view');
req.headers({
'x-appwrite-jwt': '{{apiKey}}'
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/storage/files/:fileId/view',
headers: {'x-appwrite-jwt': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/storage/files/:fileId/view';
const options = {method: 'GET', headers: {'x-appwrite-jwt': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-appwrite-jwt": @"{{apiKey}}" };
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/storage/files/:fileId/view"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
[request setAllHTTPHeaderFields:headers];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/storage/files/:fileId/view" in
let headers = Header.add (Header.init ()) "x-appwrite-jwt" "{{apiKey}}" in
Client.call ~headers `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/storage/files/:fileId/view",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-appwrite-jwt: {{apiKey}}"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/storage/files/:fileId/view', [
'headers' => [
'x-appwrite-jwt' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/storage/files/:fileId/view');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders([
'x-appwrite-jwt' => '{{apiKey}}'
]);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/storage/files/:fileId/view');
$request->setRequestMethod('GET');
$request->setHeaders([
'x-appwrite-jwt' => '{{apiKey}}'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-appwrite-jwt", "{{apiKey}}")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/storage/files/:fileId/view' -Method GET -Headers $headers
$headers=@{}
$headers.Add("x-appwrite-jwt", "{{apiKey}}")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/storage/files/:fileId/view' -Method GET -Headers $headers
import http.client
conn = http.client.HTTPSConnection("example.com")
headers = { 'x-appwrite-jwt': "{{apiKey}}" }
conn.request("GET", "/baseUrl/storage/files/:fileId/view", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/storage/files/:fileId/view"
headers = {"x-appwrite-jwt": "{{apiKey}}"}
response = requests.get(url, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/storage/files/:fileId/view"
response <- VERB("GET", url, add_headers('x-appwrite-jwt' = '{{apiKey}}'), content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/storage/files/:fileId/view")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-appwrite-jwt"] = '{{apiKey}}'
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/storage/files/:fileId/view') do |req|
req.headers['x-appwrite-jwt'] = '{{apiKey}}'
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/storage/files/:fileId/view";
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-appwrite-jwt", "{{apiKey}}".parse().unwrap());
let client = reqwest::Client::new();
let response = client.get(url)
.headers(headers)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/storage/files/:fileId/view \
--header 'x-appwrite-jwt: {{apiKey}}'
http GET {{baseUrl}}/storage/files/:fileId/view \
x-appwrite-jwt:'{{apiKey}}'
wget --quiet \
--method GET \
--header 'x-appwrite-jwt: {{apiKey}}' \
--output-document \
- {{baseUrl}}/storage/files/:fileId/view
import Foundation
let headers = ["x-appwrite-jwt": "{{apiKey}}"]
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/storage/files/:fileId/view")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
Get File
{{baseUrl}}/storage/files/:fileId
HEADERS
X-Appwrite-JWT
{{apiKey}}
QUERY PARAMS
fileId
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/storage/files/:fileId");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-appwrite-jwt: {{apiKey}}");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/storage/files/:fileId" {:headers {:x-appwrite-jwt "{{apiKey}}"}})
require "http/client"
url = "{{baseUrl}}/storage/files/:fileId"
headers = HTTP::Headers{
"x-appwrite-jwt" => "{{apiKey}}"
}
response = HTTP::Client.get url, headers: headers
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/storage/files/:fileId"),
Headers =
{
{ "x-appwrite-jwt", "{{apiKey}}" },
},
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/storage/files/:fileId");
var request = new RestRequest("", Method.Get);
request.AddHeader("x-appwrite-jwt", "{{apiKey}}");
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/storage/files/:fileId"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-appwrite-jwt", "{{apiKey}}")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/storage/files/:fileId HTTP/1.1
X-Appwrite-Jwt: {{apiKey}}
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/storage/files/:fileId")
.setHeader("x-appwrite-jwt", "{{apiKey}}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/storage/files/:fileId"))
.header("x-appwrite-jwt", "{{apiKey}}")
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/storage/files/:fileId")
.get()
.addHeader("x-appwrite-jwt", "{{apiKey}}")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/storage/files/:fileId")
.header("x-appwrite-jwt", "{{apiKey}}")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/storage/files/:fileId');
xhr.setRequestHeader('x-appwrite-jwt', '{{apiKey}}');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/storage/files/:fileId',
headers: {'x-appwrite-jwt': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/storage/files/:fileId';
const options = {method: 'GET', headers: {'x-appwrite-jwt': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/storage/files/:fileId',
method: 'GET',
headers: {
'x-appwrite-jwt': '{{apiKey}}'
}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/storage/files/:fileId")
.get()
.addHeader("x-appwrite-jwt", "{{apiKey}}")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/storage/files/:fileId',
headers: {
'x-appwrite-jwt': '{{apiKey}}'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/storage/files/:fileId',
headers: {'x-appwrite-jwt': '{{apiKey}}'}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/storage/files/:fileId');
req.headers({
'x-appwrite-jwt': '{{apiKey}}'
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/storage/files/:fileId',
headers: {'x-appwrite-jwt': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/storage/files/:fileId';
const options = {method: 'GET', headers: {'x-appwrite-jwt': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-appwrite-jwt": @"{{apiKey}}" };
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/storage/files/:fileId"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
[request setAllHTTPHeaderFields:headers];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/storage/files/:fileId" in
let headers = Header.add (Header.init ()) "x-appwrite-jwt" "{{apiKey}}" in
Client.call ~headers `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/storage/files/:fileId",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-appwrite-jwt: {{apiKey}}"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/storage/files/:fileId', [
'headers' => [
'x-appwrite-jwt' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/storage/files/:fileId');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders([
'x-appwrite-jwt' => '{{apiKey}}'
]);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/storage/files/:fileId');
$request->setRequestMethod('GET');
$request->setHeaders([
'x-appwrite-jwt' => '{{apiKey}}'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-appwrite-jwt", "{{apiKey}}")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/storage/files/:fileId' -Method GET -Headers $headers
$headers=@{}
$headers.Add("x-appwrite-jwt", "{{apiKey}}")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/storage/files/:fileId' -Method GET -Headers $headers
import http.client
conn = http.client.HTTPSConnection("example.com")
headers = { 'x-appwrite-jwt': "{{apiKey}}" }
conn.request("GET", "/baseUrl/storage/files/:fileId", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/storage/files/:fileId"
headers = {"x-appwrite-jwt": "{{apiKey}}"}
response = requests.get(url, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/storage/files/:fileId"
response <- VERB("GET", url, add_headers('x-appwrite-jwt' = '{{apiKey}}'), content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/storage/files/:fileId")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-appwrite-jwt"] = '{{apiKey}}'
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/storage/files/:fileId') do |req|
req.headers['x-appwrite-jwt'] = '{{apiKey}}'
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/storage/files/:fileId";
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-appwrite-jwt", "{{apiKey}}".parse().unwrap());
let client = reqwest::Client::new();
let response = client.get(url)
.headers(headers)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/storage/files/:fileId \
--header 'x-appwrite-jwt: {{apiKey}}'
http GET {{baseUrl}}/storage/files/:fileId \
x-appwrite-jwt:'{{apiKey}}'
wget --quiet \
--method GET \
--header 'x-appwrite-jwt: {{apiKey}}' \
--output-document \
- {{baseUrl}}/storage/files/:fileId
import Foundation
let headers = ["x-appwrite-jwt": "{{apiKey}}"]
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/storage/files/:fileId")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
List Files
{{baseUrl}}/storage/files
HEADERS
X-Appwrite-JWT
{{apiKey}}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/storage/files");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-appwrite-jwt: {{apiKey}}");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/storage/files" {:headers {:x-appwrite-jwt "{{apiKey}}"}})
require "http/client"
url = "{{baseUrl}}/storage/files"
headers = HTTP::Headers{
"x-appwrite-jwt" => "{{apiKey}}"
}
response = HTTP::Client.get url, headers: headers
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/storage/files"),
Headers =
{
{ "x-appwrite-jwt", "{{apiKey}}" },
},
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/storage/files");
var request = new RestRequest("", Method.Get);
request.AddHeader("x-appwrite-jwt", "{{apiKey}}");
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/storage/files"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-appwrite-jwt", "{{apiKey}}")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/storage/files HTTP/1.1
X-Appwrite-Jwt: {{apiKey}}
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/storage/files")
.setHeader("x-appwrite-jwt", "{{apiKey}}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/storage/files"))
.header("x-appwrite-jwt", "{{apiKey}}")
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/storage/files")
.get()
.addHeader("x-appwrite-jwt", "{{apiKey}}")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/storage/files")
.header("x-appwrite-jwt", "{{apiKey}}")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/storage/files');
xhr.setRequestHeader('x-appwrite-jwt', '{{apiKey}}');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/storage/files',
headers: {'x-appwrite-jwt': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/storage/files';
const options = {method: 'GET', headers: {'x-appwrite-jwt': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/storage/files',
method: 'GET',
headers: {
'x-appwrite-jwt': '{{apiKey}}'
}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/storage/files")
.get()
.addHeader("x-appwrite-jwt", "{{apiKey}}")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/storage/files',
headers: {
'x-appwrite-jwt': '{{apiKey}}'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/storage/files',
headers: {'x-appwrite-jwt': '{{apiKey}}'}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/storage/files');
req.headers({
'x-appwrite-jwt': '{{apiKey}}'
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/storage/files',
headers: {'x-appwrite-jwt': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/storage/files';
const options = {method: 'GET', headers: {'x-appwrite-jwt': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-appwrite-jwt": @"{{apiKey}}" };
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/storage/files"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
[request setAllHTTPHeaderFields:headers];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/storage/files" in
let headers = Header.add (Header.init ()) "x-appwrite-jwt" "{{apiKey}}" in
Client.call ~headers `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/storage/files",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-appwrite-jwt: {{apiKey}}"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/storage/files', [
'headers' => [
'x-appwrite-jwt' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/storage/files');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders([
'x-appwrite-jwt' => '{{apiKey}}'
]);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/storage/files');
$request->setRequestMethod('GET');
$request->setHeaders([
'x-appwrite-jwt' => '{{apiKey}}'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-appwrite-jwt", "{{apiKey}}")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/storage/files' -Method GET -Headers $headers
$headers=@{}
$headers.Add("x-appwrite-jwt", "{{apiKey}}")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/storage/files' -Method GET -Headers $headers
import http.client
conn = http.client.HTTPSConnection("example.com")
headers = { 'x-appwrite-jwt': "{{apiKey}}" }
conn.request("GET", "/baseUrl/storage/files", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/storage/files"
headers = {"x-appwrite-jwt": "{{apiKey}}"}
response = requests.get(url, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/storage/files"
response <- VERB("GET", url, add_headers('x-appwrite-jwt' = '{{apiKey}}'), content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/storage/files")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-appwrite-jwt"] = '{{apiKey}}'
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/storage/files') do |req|
req.headers['x-appwrite-jwt'] = '{{apiKey}}'
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/storage/files";
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-appwrite-jwt", "{{apiKey}}".parse().unwrap());
let client = reqwest::Client::new();
let response = client.get(url)
.headers(headers)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/storage/files \
--header 'x-appwrite-jwt: {{apiKey}}'
http GET {{baseUrl}}/storage/files \
x-appwrite-jwt:'{{apiKey}}'
wget --quiet \
--method GET \
--header 'x-appwrite-jwt: {{apiKey}}' \
--output-document \
- {{baseUrl}}/storage/files
import Foundation
let headers = ["x-appwrite-jwt": "{{apiKey}}"]
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/storage/files")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PUT
Update File
{{baseUrl}}/storage/files/:fileId
HEADERS
X-Appwrite-JWT
{{apiKey}}
QUERY PARAMS
fileId
BODY json
{
"read": [],
"write": []
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/storage/files/:fileId");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-appwrite-jwt: {{apiKey}}");
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"read\": [],\n \"write\": []\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/storage/files/:fileId" {:headers {:x-appwrite-jwt "{{apiKey}}"}
:content-type :json
:form-params {:read []
:write []}})
require "http/client"
url = "{{baseUrl}}/storage/files/:fileId"
headers = HTTP::Headers{
"x-appwrite-jwt" => "{{apiKey}}"
"content-type" => "application/json"
}
reqBody = "{\n \"read\": [],\n \"write\": []\n}"
response = HTTP::Client.put url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Put,
RequestUri = new Uri("{{baseUrl}}/storage/files/:fileId"),
Headers =
{
{ "x-appwrite-jwt", "{{apiKey}}" },
},
Content = new StringContent("{\n \"read\": [],\n \"write\": []\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/storage/files/:fileId");
var request = new RestRequest("", Method.Put);
request.AddHeader("x-appwrite-jwt", "{{apiKey}}");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"read\": [],\n \"write\": []\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/storage/files/:fileId"
payload := strings.NewReader("{\n \"read\": [],\n \"write\": []\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("x-appwrite-jwt", "{{apiKey}}")
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
PUT /baseUrl/storage/files/:fileId HTTP/1.1
X-Appwrite-Jwt: {{apiKey}}
Content-Type: application/json
Host: example.com
Content-Length: 31
{
"read": [],
"write": []
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/storage/files/:fileId")
.setHeader("x-appwrite-jwt", "{{apiKey}}")
.setHeader("content-type", "application/json")
.setBody("{\n \"read\": [],\n \"write\": []\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/storage/files/:fileId"))
.header("x-appwrite-jwt", "{{apiKey}}")
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"read\": [],\n \"write\": []\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"read\": [],\n \"write\": []\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/storage/files/:fileId")
.put(body)
.addHeader("x-appwrite-jwt", "{{apiKey}}")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/storage/files/:fileId")
.header("x-appwrite-jwt", "{{apiKey}}")
.header("content-type", "application/json")
.body("{\n \"read\": [],\n \"write\": []\n}")
.asString();
const data = JSON.stringify({
read: [],
write: []
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/storage/files/:fileId');
xhr.setRequestHeader('x-appwrite-jwt', '{{apiKey}}');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/storage/files/:fileId',
headers: {'x-appwrite-jwt': '{{apiKey}}', 'content-type': 'application/json'},
data: {read: [], write: []}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/storage/files/:fileId';
const options = {
method: 'PUT',
headers: {'x-appwrite-jwt': '{{apiKey}}', 'content-type': 'application/json'},
body: '{"read":[],"write":[]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/storage/files/:fileId',
method: 'PUT',
headers: {
'x-appwrite-jwt': '{{apiKey}}',
'content-type': 'application/json'
},
processData: false,
data: '{\n "read": [],\n "write": []\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"read\": [],\n \"write\": []\n}")
val request = Request.Builder()
.url("{{baseUrl}}/storage/files/:fileId")
.put(body)
.addHeader("x-appwrite-jwt", "{{apiKey}}")
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'PUT',
hostname: 'example.com',
port: null,
path: '/baseUrl/storage/files/:fileId',
headers: {
'x-appwrite-jwt': '{{apiKey}}',
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({read: [], write: []}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/storage/files/:fileId',
headers: {'x-appwrite-jwt': '{{apiKey}}', 'content-type': 'application/json'},
body: {read: [], write: []},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('PUT', '{{baseUrl}}/storage/files/:fileId');
req.headers({
'x-appwrite-jwt': '{{apiKey}}',
'content-type': 'application/json'
});
req.type('json');
req.send({
read: [],
write: []
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'PUT',
url: '{{baseUrl}}/storage/files/:fileId',
headers: {'x-appwrite-jwt': '{{apiKey}}', 'content-type': 'application/json'},
data: {read: [], write: []}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/storage/files/:fileId';
const options = {
method: 'PUT',
headers: {'x-appwrite-jwt': '{{apiKey}}', 'content-type': 'application/json'},
body: '{"read":[],"write":[]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-appwrite-jwt": @"{{apiKey}}",
@"content-type": @"application/json" };
NSDictionary *parameters = @{ @"read": @[ ],
@"write": @[ ] };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/storage/files/:fileId"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"PUT"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/storage/files/:fileId" in
let headers = Header.add_list (Header.init ()) [
("x-appwrite-jwt", "{{apiKey}}");
("content-type", "application/json");
] in
let body = Cohttp_lwt_body.of_string "{\n \"read\": [],\n \"write\": []\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/storage/files/:fileId",
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([
'read' => [
],
'write' => [
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json",
"x-appwrite-jwt: {{apiKey}}"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('PUT', '{{baseUrl}}/storage/files/:fileId', [
'body' => '{
"read": [],
"write": []
}',
'headers' => [
'content-type' => 'application/json',
'x-appwrite-jwt' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/storage/files/:fileId');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'x-appwrite-jwt' => '{{apiKey}}',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'read' => [
],
'write' => [
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'read' => [
],
'write' => [
]
]));
$request->setRequestUrl('{{baseUrl}}/storage/files/:fileId');
$request->setRequestMethod('PUT');
$request->setBody($body);
$request->setHeaders([
'x-appwrite-jwt' => '{{apiKey}}',
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-appwrite-jwt", "{{apiKey}}")
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/storage/files/:fileId' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"read": [],
"write": []
}'
$headers=@{}
$headers.Add("x-appwrite-jwt", "{{apiKey}}")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/storage/files/:fileId' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"read": [],
"write": []
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"read\": [],\n \"write\": []\n}"
headers = {
'x-appwrite-jwt': "{{apiKey}}",
'content-type': "application/json"
}
conn.request("PUT", "/baseUrl/storage/files/:fileId", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/storage/files/:fileId"
payload = {
"read": [],
"write": []
}
headers = {
"x-appwrite-jwt": "{{apiKey}}",
"content-type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/storage/files/:fileId"
payload <- "{\n \"read\": [],\n \"write\": []\n}"
encode <- "json"
response <- VERB("PUT", url, body = payload, add_headers('x-appwrite-jwt' = '{{apiKey}}'), content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/storage/files/:fileId")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["x-appwrite-jwt"] = '{{apiKey}}'
request["content-type"] = 'application/json'
request.body = "{\n \"read\": [],\n \"write\": []\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.put('/baseUrl/storage/files/:fileId') do |req|
req.headers['x-appwrite-jwt'] = '{{apiKey}}'
req.body = "{\n \"read\": [],\n \"write\": []\n}"
end
puts response.status
puts response.body
use std::str::FromStr;
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/storage/files/:fileId";
let payload = json!({
"read": (),
"write": ()
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-appwrite-jwt", "{{apiKey}}".parse().unwrap());
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("PUT").unwrap(), url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request PUT \
--url {{baseUrl}}/storage/files/:fileId \
--header 'content-type: application/json' \
--header 'x-appwrite-jwt: {{apiKey}}' \
--data '{
"read": [],
"write": []
}'
echo '{
"read": [],
"write": []
}' | \
http PUT {{baseUrl}}/storage/files/:fileId \
content-type:application/json \
x-appwrite-jwt:'{{apiKey}}'
wget --quiet \
--method PUT \
--header 'x-appwrite-jwt: {{apiKey}}' \
--header 'content-type: application/json' \
--body-data '{\n "read": [],\n "write": []\n}' \
--output-document \
- {{baseUrl}}/storage/files/:fileId
import Foundation
let headers = [
"x-appwrite-jwt": "{{apiKey}}",
"content-type": "application/json"
]
let parameters = [
"read": [],
"write": []
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/storage/files/:fileId")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
Create Team Membership
{{baseUrl}}/teams/:teamId/memberships
HEADERS
X-Appwrite-JWT
{{apiKey}}
QUERY PARAMS
teamId
BODY json
{
"email": "",
"name": "",
"roles": [],
"url": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/teams/:teamId/memberships");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-appwrite-jwt: {{apiKey}}");
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"email\": \"\",\n \"name\": \"\",\n \"roles\": [],\n \"url\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/teams/:teamId/memberships" {:headers {:x-appwrite-jwt "{{apiKey}}"}
:content-type :json
:form-params {:email ""
:name ""
:roles []
:url ""}})
require "http/client"
url = "{{baseUrl}}/teams/:teamId/memberships"
headers = HTTP::Headers{
"x-appwrite-jwt" => "{{apiKey}}"
"content-type" => "application/json"
}
reqBody = "{\n \"email\": \"\",\n \"name\": \"\",\n \"roles\": [],\n \"url\": \"\"\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/teams/:teamId/memberships"),
Headers =
{
{ "x-appwrite-jwt", "{{apiKey}}" },
},
Content = new StringContent("{\n \"email\": \"\",\n \"name\": \"\",\n \"roles\": [],\n \"url\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/teams/:teamId/memberships");
var request = new RestRequest("", Method.Post);
request.AddHeader("x-appwrite-jwt", "{{apiKey}}");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"email\": \"\",\n \"name\": \"\",\n \"roles\": [],\n \"url\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/teams/:teamId/memberships"
payload := strings.NewReader("{\n \"email\": \"\",\n \"name\": \"\",\n \"roles\": [],\n \"url\": \"\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-appwrite-jwt", "{{apiKey}}")
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/teams/:teamId/memberships HTTP/1.1
X-Appwrite-Jwt: {{apiKey}}
Content-Type: application/json
Host: example.com
Content-Length: 59
{
"email": "",
"name": "",
"roles": [],
"url": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/teams/:teamId/memberships")
.setHeader("x-appwrite-jwt", "{{apiKey}}")
.setHeader("content-type", "application/json")
.setBody("{\n \"email\": \"\",\n \"name\": \"\",\n \"roles\": [],\n \"url\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/teams/:teamId/memberships"))
.header("x-appwrite-jwt", "{{apiKey}}")
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"email\": \"\",\n \"name\": \"\",\n \"roles\": [],\n \"url\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"email\": \"\",\n \"name\": \"\",\n \"roles\": [],\n \"url\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/teams/:teamId/memberships")
.post(body)
.addHeader("x-appwrite-jwt", "{{apiKey}}")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/teams/:teamId/memberships")
.header("x-appwrite-jwt", "{{apiKey}}")
.header("content-type", "application/json")
.body("{\n \"email\": \"\",\n \"name\": \"\",\n \"roles\": [],\n \"url\": \"\"\n}")
.asString();
const data = JSON.stringify({
email: '',
name: '',
roles: [],
url: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/teams/:teamId/memberships');
xhr.setRequestHeader('x-appwrite-jwt', '{{apiKey}}');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/teams/:teamId/memberships',
headers: {'x-appwrite-jwt': '{{apiKey}}', 'content-type': 'application/json'},
data: {email: '', name: '', roles: [], url: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/teams/:teamId/memberships';
const options = {
method: 'POST',
headers: {'x-appwrite-jwt': '{{apiKey}}', 'content-type': 'application/json'},
body: '{"email":"","name":"","roles":[],"url":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/teams/:teamId/memberships',
method: 'POST',
headers: {
'x-appwrite-jwt': '{{apiKey}}',
'content-type': 'application/json'
},
processData: false,
data: '{\n "email": "",\n "name": "",\n "roles": [],\n "url": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"email\": \"\",\n \"name\": \"\",\n \"roles\": [],\n \"url\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/teams/:teamId/memberships")
.post(body)
.addHeader("x-appwrite-jwt", "{{apiKey}}")
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/teams/:teamId/memberships',
headers: {
'x-appwrite-jwt': '{{apiKey}}',
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({email: '', name: '', roles: [], url: ''}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/teams/:teamId/memberships',
headers: {'x-appwrite-jwt': '{{apiKey}}', 'content-type': 'application/json'},
body: {email: '', name: '', roles: [], url: ''},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/teams/:teamId/memberships');
req.headers({
'x-appwrite-jwt': '{{apiKey}}',
'content-type': 'application/json'
});
req.type('json');
req.send({
email: '',
name: '',
roles: [],
url: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/teams/:teamId/memberships',
headers: {'x-appwrite-jwt': '{{apiKey}}', 'content-type': 'application/json'},
data: {email: '', name: '', roles: [], url: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/teams/:teamId/memberships';
const options = {
method: 'POST',
headers: {'x-appwrite-jwt': '{{apiKey}}', 'content-type': 'application/json'},
body: '{"email":"","name":"","roles":[],"url":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-appwrite-jwt": @"{{apiKey}}",
@"content-type": @"application/json" };
NSDictionary *parameters = @{ @"email": @"",
@"name": @"",
@"roles": @[ ],
@"url": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/teams/:teamId/memberships"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/teams/:teamId/memberships" in
let headers = Header.add_list (Header.init ()) [
("x-appwrite-jwt", "{{apiKey}}");
("content-type", "application/json");
] in
let body = Cohttp_lwt_body.of_string "{\n \"email\": \"\",\n \"name\": \"\",\n \"roles\": [],\n \"url\": \"\"\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/teams/:teamId/memberships",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'email' => '',
'name' => '',
'roles' => [
],
'url' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json",
"x-appwrite-jwt: {{apiKey}}"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/teams/:teamId/memberships', [
'body' => '{
"email": "",
"name": "",
"roles": [],
"url": ""
}',
'headers' => [
'content-type' => 'application/json',
'x-appwrite-jwt' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/teams/:teamId/memberships');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'x-appwrite-jwt' => '{{apiKey}}',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'email' => '',
'name' => '',
'roles' => [
],
'url' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'email' => '',
'name' => '',
'roles' => [
],
'url' => ''
]));
$request->setRequestUrl('{{baseUrl}}/teams/:teamId/memberships');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'x-appwrite-jwt' => '{{apiKey}}',
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-appwrite-jwt", "{{apiKey}}")
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/teams/:teamId/memberships' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"email": "",
"name": "",
"roles": [],
"url": ""
}'
$headers=@{}
$headers.Add("x-appwrite-jwt", "{{apiKey}}")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/teams/:teamId/memberships' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"email": "",
"name": "",
"roles": [],
"url": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"email\": \"\",\n \"name\": \"\",\n \"roles\": [],\n \"url\": \"\"\n}"
headers = {
'x-appwrite-jwt': "{{apiKey}}",
'content-type': "application/json"
}
conn.request("POST", "/baseUrl/teams/:teamId/memberships", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/teams/:teamId/memberships"
payload = {
"email": "",
"name": "",
"roles": [],
"url": ""
}
headers = {
"x-appwrite-jwt": "{{apiKey}}",
"content-type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/teams/:teamId/memberships"
payload <- "{\n \"email\": \"\",\n \"name\": \"\",\n \"roles\": [],\n \"url\": \"\"\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, add_headers('x-appwrite-jwt' = '{{apiKey}}'), content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/teams/:teamId/memberships")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-appwrite-jwt"] = '{{apiKey}}'
request["content-type"] = 'application/json'
request.body = "{\n \"email\": \"\",\n \"name\": \"\",\n \"roles\": [],\n \"url\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/teams/:teamId/memberships') do |req|
req.headers['x-appwrite-jwt'] = '{{apiKey}}'
req.body = "{\n \"email\": \"\",\n \"name\": \"\",\n \"roles\": [],\n \"url\": \"\"\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/teams/:teamId/memberships";
let payload = json!({
"email": "",
"name": "",
"roles": (),
"url": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-appwrite-jwt", "{{apiKey}}".parse().unwrap());
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/teams/:teamId/memberships \
--header 'content-type: application/json' \
--header 'x-appwrite-jwt: {{apiKey}}' \
--data '{
"email": "",
"name": "",
"roles": [],
"url": ""
}'
echo '{
"email": "",
"name": "",
"roles": [],
"url": ""
}' | \
http POST {{baseUrl}}/teams/:teamId/memberships \
content-type:application/json \
x-appwrite-jwt:'{{apiKey}}'
wget --quiet \
--method POST \
--header 'x-appwrite-jwt: {{apiKey}}' \
--header 'content-type: application/json' \
--body-data '{\n "email": "",\n "name": "",\n "roles": [],\n "url": ""\n}' \
--output-document \
- {{baseUrl}}/teams/:teamId/memberships
import Foundation
let headers = [
"x-appwrite-jwt": "{{apiKey}}",
"content-type": "application/json"
]
let parameters = [
"email": "",
"name": "",
"roles": [],
"url": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/teams/:teamId/memberships")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
POST
Create Team
{{baseUrl}}/teams
HEADERS
X-Appwrite-JWT
{{apiKey}}
BODY json
{
"name": "",
"roles": []
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/teams");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-appwrite-jwt: {{apiKey}}");
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"name\": \"\",\n \"roles\": []\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/post "{{baseUrl}}/teams" {:headers {:x-appwrite-jwt "{{apiKey}}"}
:content-type :json
:form-params {:name ""
:roles []}})
require "http/client"
url = "{{baseUrl}}/teams"
headers = HTTP::Headers{
"x-appwrite-jwt" => "{{apiKey}}"
"content-type" => "application/json"
}
reqBody = "{\n \"name\": \"\",\n \"roles\": []\n}"
response = HTTP::Client.post url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("{{baseUrl}}/teams"),
Headers =
{
{ "x-appwrite-jwt", "{{apiKey}}" },
},
Content = new StringContent("{\n \"name\": \"\",\n \"roles\": []\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/teams");
var request = new RestRequest("", Method.Post);
request.AddHeader("x-appwrite-jwt", "{{apiKey}}");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"name\": \"\",\n \"roles\": []\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/teams"
payload := strings.NewReader("{\n \"name\": \"\",\n \"roles\": []\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-appwrite-jwt", "{{apiKey}}")
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
POST /baseUrl/teams HTTP/1.1
X-Appwrite-Jwt: {{apiKey}}
Content-Type: application/json
Host: example.com
Content-Length: 31
{
"name": "",
"roles": []
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("POST", "{{baseUrl}}/teams")
.setHeader("x-appwrite-jwt", "{{apiKey}}")
.setHeader("content-type", "application/json")
.setBody("{\n \"name\": \"\",\n \"roles\": []\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/teams"))
.header("x-appwrite-jwt", "{{apiKey}}")
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"name\": \"\",\n \"roles\": []\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"name\": \"\",\n \"roles\": []\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/teams")
.post(body)
.addHeader("x-appwrite-jwt", "{{apiKey}}")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.post("{{baseUrl}}/teams")
.header("x-appwrite-jwt", "{{apiKey}}")
.header("content-type", "application/json")
.body("{\n \"name\": \"\",\n \"roles\": []\n}")
.asString();
const data = JSON.stringify({
name: '',
roles: []
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('POST', '{{baseUrl}}/teams');
xhr.setRequestHeader('x-appwrite-jwt', '{{apiKey}}');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'POST',
url: '{{baseUrl}}/teams',
headers: {'x-appwrite-jwt': '{{apiKey}}', 'content-type': 'application/json'},
data: {name: '', roles: []}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/teams';
const options = {
method: 'POST',
headers: {'x-appwrite-jwt': '{{apiKey}}', 'content-type': 'application/json'},
body: '{"name":"","roles":[]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/teams',
method: 'POST',
headers: {
'x-appwrite-jwt': '{{apiKey}}',
'content-type': 'application/json'
},
processData: false,
data: '{\n "name": "",\n "roles": []\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"name\": \"\",\n \"roles\": []\n}")
val request = Request.Builder()
.url("{{baseUrl}}/teams")
.post(body)
.addHeader("x-appwrite-jwt", "{{apiKey}}")
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'POST',
hostname: 'example.com',
port: null,
path: '/baseUrl/teams',
headers: {
'x-appwrite-jwt': '{{apiKey}}',
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({name: '', roles: []}));
req.end();
const request = require('request');
const options = {
method: 'POST',
url: '{{baseUrl}}/teams',
headers: {'x-appwrite-jwt': '{{apiKey}}', 'content-type': 'application/json'},
body: {name: '', roles: []},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('POST', '{{baseUrl}}/teams');
req.headers({
'x-appwrite-jwt': '{{apiKey}}',
'content-type': 'application/json'
});
req.type('json');
req.send({
name: '',
roles: []
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'POST',
url: '{{baseUrl}}/teams',
headers: {'x-appwrite-jwt': '{{apiKey}}', 'content-type': 'application/json'},
data: {name: '', roles: []}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/teams';
const options = {
method: 'POST',
headers: {'x-appwrite-jwt': '{{apiKey}}', 'content-type': 'application/json'},
body: '{"name":"","roles":[]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-appwrite-jwt": @"{{apiKey}}",
@"content-type": @"application/json" };
NSDictionary *parameters = @{ @"name": @"",
@"roles": @[ ] };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/teams"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/teams" in
let headers = Header.add_list (Header.init ()) [
("x-appwrite-jwt", "{{apiKey}}");
("content-type", "application/json");
] in
let body = Cohttp_lwt_body.of_string "{\n \"name\": \"\",\n \"roles\": []\n}" in
Client.call ~headers ~body `POST uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/teams",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => '',
'roles' => [
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json",
"x-appwrite-jwt: {{apiKey}}"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('POST', '{{baseUrl}}/teams', [
'body' => '{
"name": "",
"roles": []
}',
'headers' => [
'content-type' => 'application/json',
'x-appwrite-jwt' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/teams');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders([
'x-appwrite-jwt' => '{{apiKey}}',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'name' => '',
'roles' => [
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'name' => '',
'roles' => [
]
]));
$request->setRequestUrl('{{baseUrl}}/teams');
$request->setRequestMethod('POST');
$request->setBody($body);
$request->setHeaders([
'x-appwrite-jwt' => '{{apiKey}}',
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-appwrite-jwt", "{{apiKey}}")
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/teams' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"name": "",
"roles": []
}'
$headers=@{}
$headers.Add("x-appwrite-jwt", "{{apiKey}}")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/teams' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
"name": "",
"roles": []
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"name\": \"\",\n \"roles\": []\n}"
headers = {
'x-appwrite-jwt': "{{apiKey}}",
'content-type': "application/json"
}
conn.request("POST", "/baseUrl/teams", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/teams"
payload = {
"name": "",
"roles": []
}
headers = {
"x-appwrite-jwt": "{{apiKey}}",
"content-type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/teams"
payload <- "{\n \"name\": \"\",\n \"roles\": []\n}"
encode <- "json"
response <- VERB("POST", url, body = payload, add_headers('x-appwrite-jwt' = '{{apiKey}}'), content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/teams")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-appwrite-jwt"] = '{{apiKey}}'
request["content-type"] = 'application/json'
request.body = "{\n \"name\": \"\",\n \"roles\": []\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.post('/baseUrl/teams') do |req|
req.headers['x-appwrite-jwt'] = '{{apiKey}}'
req.body = "{\n \"name\": \"\",\n \"roles\": []\n}"
end
puts response.status
puts response.body
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/teams";
let payload = json!({
"name": "",
"roles": ()
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-appwrite-jwt", "{{apiKey}}".parse().unwrap());
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.post(url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request POST \
--url {{baseUrl}}/teams \
--header 'content-type: application/json' \
--header 'x-appwrite-jwt: {{apiKey}}' \
--data '{
"name": "",
"roles": []
}'
echo '{
"name": "",
"roles": []
}' | \
http POST {{baseUrl}}/teams \
content-type:application/json \
x-appwrite-jwt:'{{apiKey}}'
wget --quiet \
--method POST \
--header 'x-appwrite-jwt: {{apiKey}}' \
--header 'content-type: application/json' \
--body-data '{\n "name": "",\n "roles": []\n}' \
--output-document \
- {{baseUrl}}/teams
import Foundation
let headers = [
"x-appwrite-jwt": "{{apiKey}}",
"content-type": "application/json"
]
let parameters = [
"name": "",
"roles": []
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/teams")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
DELETE
Delete Team Membership
{{baseUrl}}/teams/:teamId/memberships/:membershipId
HEADERS
X-Appwrite-JWT
{{apiKey}}
QUERY PARAMS
teamId
membershipId
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/teams/:teamId/memberships/:membershipId");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-appwrite-jwt: {{apiKey}}");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/teams/:teamId/memberships/:membershipId" {:headers {:x-appwrite-jwt "{{apiKey}}"}})
require "http/client"
url = "{{baseUrl}}/teams/:teamId/memberships/:membershipId"
headers = HTTP::Headers{
"x-appwrite-jwt" => "{{apiKey}}"
}
response = HTTP::Client.delete url, headers: headers
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Delete,
RequestUri = new Uri("{{baseUrl}}/teams/:teamId/memberships/:membershipId"),
Headers =
{
{ "x-appwrite-jwt", "{{apiKey}}" },
},
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/teams/:teamId/memberships/:membershipId");
var request = new RestRequest("", Method.Delete);
request.AddHeader("x-appwrite-jwt", "{{apiKey}}");
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/teams/:teamId/memberships/:membershipId"
req, _ := http.NewRequest("DELETE", url, nil)
req.Header.Add("x-appwrite-jwt", "{{apiKey}}")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
DELETE /baseUrl/teams/:teamId/memberships/:membershipId HTTP/1.1
X-Appwrite-Jwt: {{apiKey}}
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/teams/:teamId/memberships/:membershipId")
.setHeader("x-appwrite-jwt", "{{apiKey}}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/teams/:teamId/memberships/:membershipId"))
.header("x-appwrite-jwt", "{{apiKey}}")
.method("DELETE", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/teams/:teamId/memberships/:membershipId")
.delete(null)
.addHeader("x-appwrite-jwt", "{{apiKey}}")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/teams/:teamId/memberships/:membershipId")
.header("x-appwrite-jwt", "{{apiKey}}")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('DELETE', '{{baseUrl}}/teams/:teamId/memberships/:membershipId');
xhr.setRequestHeader('x-appwrite-jwt', '{{apiKey}}');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'DELETE',
url: '{{baseUrl}}/teams/:teamId/memberships/:membershipId',
headers: {'x-appwrite-jwt': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/teams/:teamId/memberships/:membershipId';
const options = {method: 'DELETE', headers: {'x-appwrite-jwt': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/teams/:teamId/memberships/:membershipId',
method: 'DELETE',
headers: {
'x-appwrite-jwt': '{{apiKey}}'
}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/teams/:teamId/memberships/:membershipId")
.delete(null)
.addHeader("x-appwrite-jwt", "{{apiKey}}")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'DELETE',
hostname: 'example.com',
port: null,
path: '/baseUrl/teams/:teamId/memberships/:membershipId',
headers: {
'x-appwrite-jwt': '{{apiKey}}'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'DELETE',
url: '{{baseUrl}}/teams/:teamId/memberships/:membershipId',
headers: {'x-appwrite-jwt': '{{apiKey}}'}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('DELETE', '{{baseUrl}}/teams/:teamId/memberships/:membershipId');
req.headers({
'x-appwrite-jwt': '{{apiKey}}'
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'DELETE',
url: '{{baseUrl}}/teams/:teamId/memberships/:membershipId',
headers: {'x-appwrite-jwt': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/teams/:teamId/memberships/:membershipId';
const options = {method: 'DELETE', headers: {'x-appwrite-jwt': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-appwrite-jwt": @"{{apiKey}}" };
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/teams/:teamId/memberships/:membershipId"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"DELETE"];
[request setAllHTTPHeaderFields:headers];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/teams/:teamId/memberships/:membershipId" in
let headers = Header.add (Header.init ()) "x-appwrite-jwt" "{{apiKey}}" in
Client.call ~headers `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/teams/:teamId/memberships/:membershipId",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_HTTPHEADER => [
"x-appwrite-jwt: {{apiKey}}"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('DELETE', '{{baseUrl}}/teams/:teamId/memberships/:membershipId', [
'headers' => [
'x-appwrite-jwt' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/teams/:teamId/memberships/:membershipId');
$request->setMethod(HTTP_METH_DELETE);
$request->setHeaders([
'x-appwrite-jwt' => '{{apiKey}}'
]);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/teams/:teamId/memberships/:membershipId');
$request->setRequestMethod('DELETE');
$request->setHeaders([
'x-appwrite-jwt' => '{{apiKey}}'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-appwrite-jwt", "{{apiKey}}")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/teams/:teamId/memberships/:membershipId' -Method DELETE -Headers $headers
$headers=@{}
$headers.Add("x-appwrite-jwt", "{{apiKey}}")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/teams/:teamId/memberships/:membershipId' -Method DELETE -Headers $headers
import http.client
conn = http.client.HTTPSConnection("example.com")
headers = { 'x-appwrite-jwt': "{{apiKey}}" }
conn.request("DELETE", "/baseUrl/teams/:teamId/memberships/:membershipId", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/teams/:teamId/memberships/:membershipId"
headers = {"x-appwrite-jwt": "{{apiKey}}"}
response = requests.delete(url, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/teams/:teamId/memberships/:membershipId"
response <- VERB("DELETE", url, add_headers('x-appwrite-jwt' = '{{apiKey}}'), content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/teams/:teamId/memberships/:membershipId")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["x-appwrite-jwt"] = '{{apiKey}}'
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.delete('/baseUrl/teams/:teamId/memberships/:membershipId') do |req|
req.headers['x-appwrite-jwt'] = '{{apiKey}}'
end
puts response.status
puts response.body
use std::str::FromStr;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/teams/:teamId/memberships/:membershipId";
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-appwrite-jwt", "{{apiKey}}".parse().unwrap());
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("DELETE").unwrap(), url)
.headers(headers)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request DELETE \
--url {{baseUrl}}/teams/:teamId/memberships/:membershipId \
--header 'x-appwrite-jwt: {{apiKey}}'
http DELETE {{baseUrl}}/teams/:teamId/memberships/:membershipId \
x-appwrite-jwt:'{{apiKey}}'
wget --quiet \
--method DELETE \
--header 'x-appwrite-jwt: {{apiKey}}' \
--output-document \
- {{baseUrl}}/teams/:teamId/memberships/:membershipId
import Foundation
let headers = ["x-appwrite-jwt": "{{apiKey}}"]
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/teams/:teamId/memberships/:membershipId")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "DELETE"
request.allHTTPHeaderFields = headers
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
DELETE
Delete Team
{{baseUrl}}/teams/:teamId
HEADERS
X-Appwrite-JWT
{{apiKey}}
QUERY PARAMS
teamId
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/teams/:teamId");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-appwrite-jwt: {{apiKey}}");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/delete "{{baseUrl}}/teams/:teamId" {:headers {:x-appwrite-jwt "{{apiKey}}"}})
require "http/client"
url = "{{baseUrl}}/teams/:teamId"
headers = HTTP::Headers{
"x-appwrite-jwt" => "{{apiKey}}"
}
response = HTTP::Client.delete url, headers: headers
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Delete,
RequestUri = new Uri("{{baseUrl}}/teams/:teamId"),
Headers =
{
{ "x-appwrite-jwt", "{{apiKey}}" },
},
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/teams/:teamId");
var request = new RestRequest("", Method.Delete);
request.AddHeader("x-appwrite-jwt", "{{apiKey}}");
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/teams/:teamId"
req, _ := http.NewRequest("DELETE", url, nil)
req.Header.Add("x-appwrite-jwt", "{{apiKey}}")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
DELETE /baseUrl/teams/:teamId HTTP/1.1
X-Appwrite-Jwt: {{apiKey}}
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("DELETE", "{{baseUrl}}/teams/:teamId")
.setHeader("x-appwrite-jwt", "{{apiKey}}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/teams/:teamId"))
.header("x-appwrite-jwt", "{{apiKey}}")
.method("DELETE", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/teams/:teamId")
.delete(null)
.addHeader("x-appwrite-jwt", "{{apiKey}}")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.delete("{{baseUrl}}/teams/:teamId")
.header("x-appwrite-jwt", "{{apiKey}}")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('DELETE', '{{baseUrl}}/teams/:teamId');
xhr.setRequestHeader('x-appwrite-jwt', '{{apiKey}}');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'DELETE',
url: '{{baseUrl}}/teams/:teamId',
headers: {'x-appwrite-jwt': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/teams/:teamId';
const options = {method: 'DELETE', headers: {'x-appwrite-jwt': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/teams/:teamId',
method: 'DELETE',
headers: {
'x-appwrite-jwt': '{{apiKey}}'
}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/teams/:teamId")
.delete(null)
.addHeader("x-appwrite-jwt", "{{apiKey}}")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'DELETE',
hostname: 'example.com',
port: null,
path: '/baseUrl/teams/:teamId',
headers: {
'x-appwrite-jwt': '{{apiKey}}'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'DELETE',
url: '{{baseUrl}}/teams/:teamId',
headers: {'x-appwrite-jwt': '{{apiKey}}'}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('DELETE', '{{baseUrl}}/teams/:teamId');
req.headers({
'x-appwrite-jwt': '{{apiKey}}'
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'DELETE',
url: '{{baseUrl}}/teams/:teamId',
headers: {'x-appwrite-jwt': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/teams/:teamId';
const options = {method: 'DELETE', headers: {'x-appwrite-jwt': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-appwrite-jwt": @"{{apiKey}}" };
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/teams/:teamId"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"DELETE"];
[request setAllHTTPHeaderFields:headers];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/teams/:teamId" in
let headers = Header.add (Header.init ()) "x-appwrite-jwt" "{{apiKey}}" in
Client.call ~headers `DELETE uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/teams/:teamId",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_HTTPHEADER => [
"x-appwrite-jwt: {{apiKey}}"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('DELETE', '{{baseUrl}}/teams/:teamId', [
'headers' => [
'x-appwrite-jwt' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/teams/:teamId');
$request->setMethod(HTTP_METH_DELETE);
$request->setHeaders([
'x-appwrite-jwt' => '{{apiKey}}'
]);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/teams/:teamId');
$request->setRequestMethod('DELETE');
$request->setHeaders([
'x-appwrite-jwt' => '{{apiKey}}'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-appwrite-jwt", "{{apiKey}}")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/teams/:teamId' -Method DELETE -Headers $headers
$headers=@{}
$headers.Add("x-appwrite-jwt", "{{apiKey}}")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/teams/:teamId' -Method DELETE -Headers $headers
import http.client
conn = http.client.HTTPSConnection("example.com")
headers = { 'x-appwrite-jwt': "{{apiKey}}" }
conn.request("DELETE", "/baseUrl/teams/:teamId", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/teams/:teamId"
headers = {"x-appwrite-jwt": "{{apiKey}}"}
response = requests.delete(url, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/teams/:teamId"
response <- VERB("DELETE", url, add_headers('x-appwrite-jwt' = '{{apiKey}}'), content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/teams/:teamId")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["x-appwrite-jwt"] = '{{apiKey}}'
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.delete('/baseUrl/teams/:teamId') do |req|
req.headers['x-appwrite-jwt'] = '{{apiKey}}'
end
puts response.status
puts response.body
use std::str::FromStr;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/teams/:teamId";
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-appwrite-jwt", "{{apiKey}}".parse().unwrap());
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("DELETE").unwrap(), url)
.headers(headers)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request DELETE \
--url {{baseUrl}}/teams/:teamId \
--header 'x-appwrite-jwt: {{apiKey}}'
http DELETE {{baseUrl}}/teams/:teamId \
x-appwrite-jwt:'{{apiKey}}'
wget --quiet \
--method DELETE \
--header 'x-appwrite-jwt: {{apiKey}}' \
--output-document \
- {{baseUrl}}/teams/:teamId
import Foundation
let headers = ["x-appwrite-jwt": "{{apiKey}}"]
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/teams/:teamId")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "DELETE"
request.allHTTPHeaderFields = headers
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
Get Team Memberships
{{baseUrl}}/teams/:teamId/memberships
HEADERS
X-Appwrite-JWT
{{apiKey}}
QUERY PARAMS
teamId
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/teams/:teamId/memberships");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-appwrite-jwt: {{apiKey}}");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/teams/:teamId/memberships" {:headers {:x-appwrite-jwt "{{apiKey}}"}})
require "http/client"
url = "{{baseUrl}}/teams/:teamId/memberships"
headers = HTTP::Headers{
"x-appwrite-jwt" => "{{apiKey}}"
}
response = HTTP::Client.get url, headers: headers
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/teams/:teamId/memberships"),
Headers =
{
{ "x-appwrite-jwt", "{{apiKey}}" },
},
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/teams/:teamId/memberships");
var request = new RestRequest("", Method.Get);
request.AddHeader("x-appwrite-jwt", "{{apiKey}}");
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/teams/:teamId/memberships"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-appwrite-jwt", "{{apiKey}}")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/teams/:teamId/memberships HTTP/1.1
X-Appwrite-Jwt: {{apiKey}}
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/teams/:teamId/memberships")
.setHeader("x-appwrite-jwt", "{{apiKey}}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/teams/:teamId/memberships"))
.header("x-appwrite-jwt", "{{apiKey}}")
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/teams/:teamId/memberships")
.get()
.addHeader("x-appwrite-jwt", "{{apiKey}}")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/teams/:teamId/memberships")
.header("x-appwrite-jwt", "{{apiKey}}")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/teams/:teamId/memberships');
xhr.setRequestHeader('x-appwrite-jwt', '{{apiKey}}');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/teams/:teamId/memberships',
headers: {'x-appwrite-jwt': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/teams/:teamId/memberships';
const options = {method: 'GET', headers: {'x-appwrite-jwt': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/teams/:teamId/memberships',
method: 'GET',
headers: {
'x-appwrite-jwt': '{{apiKey}}'
}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/teams/:teamId/memberships")
.get()
.addHeader("x-appwrite-jwt", "{{apiKey}}")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/teams/:teamId/memberships',
headers: {
'x-appwrite-jwt': '{{apiKey}}'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/teams/:teamId/memberships',
headers: {'x-appwrite-jwt': '{{apiKey}}'}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/teams/:teamId/memberships');
req.headers({
'x-appwrite-jwt': '{{apiKey}}'
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/teams/:teamId/memberships',
headers: {'x-appwrite-jwt': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/teams/:teamId/memberships';
const options = {method: 'GET', headers: {'x-appwrite-jwt': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-appwrite-jwt": @"{{apiKey}}" };
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/teams/:teamId/memberships"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
[request setAllHTTPHeaderFields:headers];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/teams/:teamId/memberships" in
let headers = Header.add (Header.init ()) "x-appwrite-jwt" "{{apiKey}}" in
Client.call ~headers `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/teams/:teamId/memberships",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-appwrite-jwt: {{apiKey}}"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/teams/:teamId/memberships', [
'headers' => [
'x-appwrite-jwt' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/teams/:teamId/memberships');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders([
'x-appwrite-jwt' => '{{apiKey}}'
]);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/teams/:teamId/memberships');
$request->setRequestMethod('GET');
$request->setHeaders([
'x-appwrite-jwt' => '{{apiKey}}'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-appwrite-jwt", "{{apiKey}}")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/teams/:teamId/memberships' -Method GET -Headers $headers
$headers=@{}
$headers.Add("x-appwrite-jwt", "{{apiKey}}")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/teams/:teamId/memberships' -Method GET -Headers $headers
import http.client
conn = http.client.HTTPSConnection("example.com")
headers = { 'x-appwrite-jwt': "{{apiKey}}" }
conn.request("GET", "/baseUrl/teams/:teamId/memberships", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/teams/:teamId/memberships"
headers = {"x-appwrite-jwt": "{{apiKey}}"}
response = requests.get(url, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/teams/:teamId/memberships"
response <- VERB("GET", url, add_headers('x-appwrite-jwt' = '{{apiKey}}'), content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/teams/:teamId/memberships")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-appwrite-jwt"] = '{{apiKey}}'
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/teams/:teamId/memberships') do |req|
req.headers['x-appwrite-jwt'] = '{{apiKey}}'
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/teams/:teamId/memberships";
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-appwrite-jwt", "{{apiKey}}".parse().unwrap());
let client = reqwest::Client::new();
let response = client.get(url)
.headers(headers)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/teams/:teamId/memberships \
--header 'x-appwrite-jwt: {{apiKey}}'
http GET {{baseUrl}}/teams/:teamId/memberships \
x-appwrite-jwt:'{{apiKey}}'
wget --quiet \
--method GET \
--header 'x-appwrite-jwt: {{apiKey}}' \
--output-document \
- {{baseUrl}}/teams/:teamId/memberships
import Foundation
let headers = ["x-appwrite-jwt": "{{apiKey}}"]
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/teams/:teamId/memberships")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
Get Team
{{baseUrl}}/teams/:teamId
HEADERS
X-Appwrite-JWT
{{apiKey}}
QUERY PARAMS
teamId
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/teams/:teamId");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-appwrite-jwt: {{apiKey}}");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/teams/:teamId" {:headers {:x-appwrite-jwt "{{apiKey}}"}})
require "http/client"
url = "{{baseUrl}}/teams/:teamId"
headers = HTTP::Headers{
"x-appwrite-jwt" => "{{apiKey}}"
}
response = HTTP::Client.get url, headers: headers
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/teams/:teamId"),
Headers =
{
{ "x-appwrite-jwt", "{{apiKey}}" },
},
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/teams/:teamId");
var request = new RestRequest("", Method.Get);
request.AddHeader("x-appwrite-jwt", "{{apiKey}}");
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/teams/:teamId"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-appwrite-jwt", "{{apiKey}}")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/teams/:teamId HTTP/1.1
X-Appwrite-Jwt: {{apiKey}}
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/teams/:teamId")
.setHeader("x-appwrite-jwt", "{{apiKey}}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/teams/:teamId"))
.header("x-appwrite-jwt", "{{apiKey}}")
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/teams/:teamId")
.get()
.addHeader("x-appwrite-jwt", "{{apiKey}}")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/teams/:teamId")
.header("x-appwrite-jwt", "{{apiKey}}")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/teams/:teamId');
xhr.setRequestHeader('x-appwrite-jwt', '{{apiKey}}');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/teams/:teamId',
headers: {'x-appwrite-jwt': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/teams/:teamId';
const options = {method: 'GET', headers: {'x-appwrite-jwt': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/teams/:teamId',
method: 'GET',
headers: {
'x-appwrite-jwt': '{{apiKey}}'
}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/teams/:teamId")
.get()
.addHeader("x-appwrite-jwt", "{{apiKey}}")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/teams/:teamId',
headers: {
'x-appwrite-jwt': '{{apiKey}}'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/teams/:teamId',
headers: {'x-appwrite-jwt': '{{apiKey}}'}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/teams/:teamId');
req.headers({
'x-appwrite-jwt': '{{apiKey}}'
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/teams/:teamId',
headers: {'x-appwrite-jwt': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/teams/:teamId';
const options = {method: 'GET', headers: {'x-appwrite-jwt': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-appwrite-jwt": @"{{apiKey}}" };
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/teams/:teamId"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
[request setAllHTTPHeaderFields:headers];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/teams/:teamId" in
let headers = Header.add (Header.init ()) "x-appwrite-jwt" "{{apiKey}}" in
Client.call ~headers `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/teams/:teamId",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-appwrite-jwt: {{apiKey}}"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/teams/:teamId', [
'headers' => [
'x-appwrite-jwt' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/teams/:teamId');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders([
'x-appwrite-jwt' => '{{apiKey}}'
]);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/teams/:teamId');
$request->setRequestMethod('GET');
$request->setHeaders([
'x-appwrite-jwt' => '{{apiKey}}'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-appwrite-jwt", "{{apiKey}}")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/teams/:teamId' -Method GET -Headers $headers
$headers=@{}
$headers.Add("x-appwrite-jwt", "{{apiKey}}")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/teams/:teamId' -Method GET -Headers $headers
import http.client
conn = http.client.HTTPSConnection("example.com")
headers = { 'x-appwrite-jwt': "{{apiKey}}" }
conn.request("GET", "/baseUrl/teams/:teamId", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/teams/:teamId"
headers = {"x-appwrite-jwt": "{{apiKey}}"}
response = requests.get(url, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/teams/:teamId"
response <- VERB("GET", url, add_headers('x-appwrite-jwt' = '{{apiKey}}'), content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/teams/:teamId")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-appwrite-jwt"] = '{{apiKey}}'
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/teams/:teamId') do |req|
req.headers['x-appwrite-jwt'] = '{{apiKey}}'
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/teams/:teamId";
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-appwrite-jwt", "{{apiKey}}".parse().unwrap());
let client = reqwest::Client::new();
let response = client.get(url)
.headers(headers)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/teams/:teamId \
--header 'x-appwrite-jwt: {{apiKey}}'
http GET {{baseUrl}}/teams/:teamId \
x-appwrite-jwt:'{{apiKey}}'
wget --quiet \
--method GET \
--header 'x-appwrite-jwt: {{apiKey}}' \
--output-document \
- {{baseUrl}}/teams/:teamId
import Foundation
let headers = ["x-appwrite-jwt": "{{apiKey}}"]
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/teams/:teamId")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
GET
List Teams
{{baseUrl}}/teams
HEADERS
X-Appwrite-JWT
{{apiKey}}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "GET");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/teams");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-appwrite-jwt: {{apiKey}}");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/get "{{baseUrl}}/teams" {:headers {:x-appwrite-jwt "{{apiKey}}"}})
require "http/client"
url = "{{baseUrl}}/teams"
headers = HTTP::Headers{
"x-appwrite-jwt" => "{{apiKey}}"
}
response = HTTP::Client.get url, headers: headers
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("{{baseUrl}}/teams"),
Headers =
{
{ "x-appwrite-jwt", "{{apiKey}}" },
},
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/teams");
var request = new RestRequest("", Method.Get);
request.AddHeader("x-appwrite-jwt", "{{apiKey}}");
var response = client.Execute(request);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/teams"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-appwrite-jwt", "{{apiKey}}")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
GET /baseUrl/teams HTTP/1.1
X-Appwrite-Jwt: {{apiKey}}
Host: example.com
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("GET", "{{baseUrl}}/teams")
.setHeader("x-appwrite-jwt", "{{apiKey}}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/teams"))
.header("x-appwrite-jwt", "{{apiKey}}")
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("{{baseUrl}}/teams")
.get()
.addHeader("x-appwrite-jwt", "{{apiKey}}")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.get("{{baseUrl}}/teams")
.header("x-appwrite-jwt", "{{apiKey}}")
.asString();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('GET', '{{baseUrl}}/teams');
xhr.setRequestHeader('x-appwrite-jwt', '{{apiKey}}');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'GET',
url: '{{baseUrl}}/teams',
headers: {'x-appwrite-jwt': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/teams';
const options = {method: 'GET', headers: {'x-appwrite-jwt': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/teams',
method: 'GET',
headers: {
'x-appwrite-jwt': '{{apiKey}}'
}
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val request = Request.Builder()
.url("{{baseUrl}}/teams")
.get()
.addHeader("x-appwrite-jwt", "{{apiKey}}")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'GET',
hostname: 'example.com',
port: null,
path: '/baseUrl/teams',
headers: {
'x-appwrite-jwt': '{{apiKey}}'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
const request = require('request');
const options = {
method: 'GET',
url: '{{baseUrl}}/teams',
headers: {'x-appwrite-jwt': '{{apiKey}}'}
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('GET', '{{baseUrl}}/teams');
req.headers({
'x-appwrite-jwt': '{{apiKey}}'
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'GET',
url: '{{baseUrl}}/teams',
headers: {'x-appwrite-jwt': '{{apiKey}}'}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/teams';
const options = {method: 'GET', headers: {'x-appwrite-jwt': '{{apiKey}}'}};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-appwrite-jwt": @"{{apiKey}}" };
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/teams"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"GET"];
[request setAllHTTPHeaderFields:headers];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/teams" in
let headers = Header.add (Header.init ()) "x-appwrite-jwt" "{{apiKey}}" in
Client.call ~headers `GET uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/teams",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-appwrite-jwt: {{apiKey}}"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('GET', '{{baseUrl}}/teams', [
'headers' => [
'x-appwrite-jwt' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/teams');
$request->setMethod(HTTP_METH_GET);
$request->setHeaders([
'x-appwrite-jwt' => '{{apiKey}}'
]);
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
setRequestUrl('{{baseUrl}}/teams');
$request->setRequestMethod('GET');
$request->setHeaders([
'x-appwrite-jwt' => '{{apiKey}}'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-appwrite-jwt", "{{apiKey}}")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/teams' -Method GET -Headers $headers
$headers=@{}
$headers.Add("x-appwrite-jwt", "{{apiKey}}")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/teams' -Method GET -Headers $headers
import http.client
conn = http.client.HTTPSConnection("example.com")
headers = { 'x-appwrite-jwt': "{{apiKey}}" }
conn.request("GET", "/baseUrl/teams", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/teams"
headers = {"x-appwrite-jwt": "{{apiKey}}"}
response = requests.get(url, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/teams"
response <- VERB("GET", url, add_headers('x-appwrite-jwt' = '{{apiKey}}'), content_type("application/octet-stream"))
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/teams")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-appwrite-jwt"] = '{{apiKey}}'
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
)
response = conn.get('/baseUrl/teams') do |req|
req.headers['x-appwrite-jwt'] = '{{apiKey}}'
end
puts response.status
puts response.body
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/teams";
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-appwrite-jwt", "{{apiKey}}".parse().unwrap());
let client = reqwest::Client::new();
let response = client.get(url)
.headers(headers)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request GET \
--url {{baseUrl}}/teams \
--header 'x-appwrite-jwt: {{apiKey}}'
http GET {{baseUrl}}/teams \
x-appwrite-jwt:'{{apiKey}}'
wget --quiet \
--method GET \
--header 'x-appwrite-jwt: {{apiKey}}' \
--output-document \
- {{baseUrl}}/teams
import Foundation
let headers = ["x-appwrite-jwt": "{{apiKey}}"]
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/teams")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PATCH
Update Membership Roles
{{baseUrl}}/teams/:teamId/memberships/:membershipId
HEADERS
X-Appwrite-JWT
{{apiKey}}
QUERY PARAMS
teamId
membershipId
BODY json
{
"roles": []
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PATCH");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/teams/:teamId/memberships/:membershipId");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-appwrite-jwt: {{apiKey}}");
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"roles\": []\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/patch "{{baseUrl}}/teams/:teamId/memberships/:membershipId" {:headers {:x-appwrite-jwt "{{apiKey}}"}
:content-type :json
:form-params {:roles []}})
require "http/client"
url = "{{baseUrl}}/teams/:teamId/memberships/:membershipId"
headers = HTTP::Headers{
"x-appwrite-jwt" => "{{apiKey}}"
"content-type" => "application/json"
}
reqBody = "{\n \"roles\": []\n}"
response = HTTP::Client.patch url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Patch,
RequestUri = new Uri("{{baseUrl}}/teams/:teamId/memberships/:membershipId"),
Headers =
{
{ "x-appwrite-jwt", "{{apiKey}}" },
},
Content = new StringContent("{\n \"roles\": []\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/teams/:teamId/memberships/:membershipId");
var request = new RestRequest("", Method.Patch);
request.AddHeader("x-appwrite-jwt", "{{apiKey}}");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"roles\": []\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/teams/:teamId/memberships/:membershipId"
payload := strings.NewReader("{\n \"roles\": []\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("x-appwrite-jwt", "{{apiKey}}")
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
PATCH /baseUrl/teams/:teamId/memberships/:membershipId HTTP/1.1
X-Appwrite-Jwt: {{apiKey}}
Content-Type: application/json
Host: example.com
Content-Length: 17
{
"roles": []
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PATCH", "{{baseUrl}}/teams/:teamId/memberships/:membershipId")
.setHeader("x-appwrite-jwt", "{{apiKey}}")
.setHeader("content-type", "application/json")
.setBody("{\n \"roles\": []\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/teams/:teamId/memberships/:membershipId"))
.header("x-appwrite-jwt", "{{apiKey}}")
.header("content-type", "application/json")
.method("PATCH", HttpRequest.BodyPublishers.ofString("{\n \"roles\": []\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"roles\": []\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/teams/:teamId/memberships/:membershipId")
.patch(body)
.addHeader("x-appwrite-jwt", "{{apiKey}}")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.patch("{{baseUrl}}/teams/:teamId/memberships/:membershipId")
.header("x-appwrite-jwt", "{{apiKey}}")
.header("content-type", "application/json")
.body("{\n \"roles\": []\n}")
.asString();
const data = JSON.stringify({
roles: []
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PATCH', '{{baseUrl}}/teams/:teamId/memberships/:membershipId');
xhr.setRequestHeader('x-appwrite-jwt', '{{apiKey}}');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PATCH',
url: '{{baseUrl}}/teams/:teamId/memberships/:membershipId',
headers: {'x-appwrite-jwt': '{{apiKey}}', 'content-type': 'application/json'},
data: {roles: []}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/teams/:teamId/memberships/:membershipId';
const options = {
method: 'PATCH',
headers: {'x-appwrite-jwt': '{{apiKey}}', 'content-type': 'application/json'},
body: '{"roles":[]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/teams/:teamId/memberships/:membershipId',
method: 'PATCH',
headers: {
'x-appwrite-jwt': '{{apiKey}}',
'content-type': 'application/json'
},
processData: false,
data: '{\n "roles": []\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"roles\": []\n}")
val request = Request.Builder()
.url("{{baseUrl}}/teams/:teamId/memberships/:membershipId")
.patch(body)
.addHeader("x-appwrite-jwt", "{{apiKey}}")
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'PATCH',
hostname: 'example.com',
port: null,
path: '/baseUrl/teams/:teamId/memberships/:membershipId',
headers: {
'x-appwrite-jwt': '{{apiKey}}',
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({roles: []}));
req.end();
const request = require('request');
const options = {
method: 'PATCH',
url: '{{baseUrl}}/teams/:teamId/memberships/:membershipId',
headers: {'x-appwrite-jwt': '{{apiKey}}', 'content-type': 'application/json'},
body: {roles: []},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('PATCH', '{{baseUrl}}/teams/:teamId/memberships/:membershipId');
req.headers({
'x-appwrite-jwt': '{{apiKey}}',
'content-type': 'application/json'
});
req.type('json');
req.send({
roles: []
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'PATCH',
url: '{{baseUrl}}/teams/:teamId/memberships/:membershipId',
headers: {'x-appwrite-jwt': '{{apiKey}}', 'content-type': 'application/json'},
data: {roles: []}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/teams/:teamId/memberships/:membershipId';
const options = {
method: 'PATCH',
headers: {'x-appwrite-jwt': '{{apiKey}}', 'content-type': 'application/json'},
body: '{"roles":[]}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-appwrite-jwt": @"{{apiKey}}",
@"content-type": @"application/json" };
NSDictionary *parameters = @{ @"roles": @[ ] };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/teams/:teamId/memberships/:membershipId"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"PATCH"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/teams/:teamId/memberships/:membershipId" in
let headers = Header.add_list (Header.init ()) [
("x-appwrite-jwt", "{{apiKey}}");
("content-type", "application/json");
] in
let body = Cohttp_lwt_body.of_string "{\n \"roles\": []\n}" in
Client.call ~headers ~body `PATCH uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/teams/:teamId/memberships/:membershipId",
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([
'roles' => [
]
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json",
"x-appwrite-jwt: {{apiKey}}"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('PATCH', '{{baseUrl}}/teams/:teamId/memberships/:membershipId', [
'body' => '{
"roles": []
}',
'headers' => [
'content-type' => 'application/json',
'x-appwrite-jwt' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/teams/:teamId/memberships/:membershipId');
$request->setMethod(HttpRequest::HTTP_METH_PATCH);
$request->setHeaders([
'x-appwrite-jwt' => '{{apiKey}}',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'roles' => [
]
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'roles' => [
]
]));
$request->setRequestUrl('{{baseUrl}}/teams/:teamId/memberships/:membershipId');
$request->setRequestMethod('PATCH');
$request->setBody($body);
$request->setHeaders([
'x-appwrite-jwt' => '{{apiKey}}',
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-appwrite-jwt", "{{apiKey}}")
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/teams/:teamId/memberships/:membershipId' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"roles": []
}'
$headers=@{}
$headers.Add("x-appwrite-jwt", "{{apiKey}}")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/teams/:teamId/memberships/:membershipId' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"roles": []
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"roles\": []\n}"
headers = {
'x-appwrite-jwt': "{{apiKey}}",
'content-type': "application/json"
}
conn.request("PATCH", "/baseUrl/teams/:teamId/memberships/:membershipId", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/teams/:teamId/memberships/:membershipId"
payload = { "roles": [] }
headers = {
"x-appwrite-jwt": "{{apiKey}}",
"content-type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/teams/:teamId/memberships/:membershipId"
payload <- "{\n \"roles\": []\n}"
encode <- "json"
response <- VERB("PATCH", url, body = payload, add_headers('x-appwrite-jwt' = '{{apiKey}}'), content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/teams/:teamId/memberships/:membershipId")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["x-appwrite-jwt"] = '{{apiKey}}'
request["content-type"] = 'application/json'
request.body = "{\n \"roles\": []\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.patch('/baseUrl/teams/:teamId/memberships/:membershipId') do |req|
req.headers['x-appwrite-jwt'] = '{{apiKey}}'
req.body = "{\n \"roles\": []\n}"
end
puts response.status
puts response.body
use std::str::FromStr;
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/teams/:teamId/memberships/:membershipId";
let payload = json!({"roles": ()});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-appwrite-jwt", "{{apiKey}}".parse().unwrap());
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("PATCH").unwrap(), url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request PATCH \
--url {{baseUrl}}/teams/:teamId/memberships/:membershipId \
--header 'content-type: application/json' \
--header 'x-appwrite-jwt: {{apiKey}}' \
--data '{
"roles": []
}'
echo '{
"roles": []
}' | \
http PATCH {{baseUrl}}/teams/:teamId/memberships/:membershipId \
content-type:application/json \
x-appwrite-jwt:'{{apiKey}}'
wget --quiet \
--method PATCH \
--header 'x-appwrite-jwt: {{apiKey}}' \
--header 'content-type: application/json' \
--body-data '{\n "roles": []\n}' \
--output-document \
- {{baseUrl}}/teams/:teamId/memberships/:membershipId
import Foundation
let headers = [
"x-appwrite-jwt": "{{apiKey}}",
"content-type": "application/json"
]
let parameters = ["roles": []] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/teams/:teamId/memberships/:membershipId")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PATCH"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PATCH
Update Team Membership Status
{{baseUrl}}/teams/:teamId/memberships/:membershipId/status
HEADERS
X-Appwrite-JWT
{{apiKey}}
QUERY PARAMS
teamId
membershipId
BODY json
{
"secret": "",
"userId": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PATCH");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/teams/:teamId/memberships/:membershipId/status");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-appwrite-jwt: {{apiKey}}");
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"secret\": \"\",\n \"userId\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/patch "{{baseUrl}}/teams/:teamId/memberships/:membershipId/status" {:headers {:x-appwrite-jwt "{{apiKey}}"}
:content-type :json
:form-params {:secret ""
:userId ""}})
require "http/client"
url = "{{baseUrl}}/teams/:teamId/memberships/:membershipId/status"
headers = HTTP::Headers{
"x-appwrite-jwt" => "{{apiKey}}"
"content-type" => "application/json"
}
reqBody = "{\n \"secret\": \"\",\n \"userId\": \"\"\n}"
response = HTTP::Client.patch url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Patch,
RequestUri = new Uri("{{baseUrl}}/teams/:teamId/memberships/:membershipId/status"),
Headers =
{
{ "x-appwrite-jwt", "{{apiKey}}" },
},
Content = new StringContent("{\n \"secret\": \"\",\n \"userId\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/teams/:teamId/memberships/:membershipId/status");
var request = new RestRequest("", Method.Patch);
request.AddHeader("x-appwrite-jwt", "{{apiKey}}");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"secret\": \"\",\n \"userId\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/teams/:teamId/memberships/:membershipId/status"
payload := strings.NewReader("{\n \"secret\": \"\",\n \"userId\": \"\"\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("x-appwrite-jwt", "{{apiKey}}")
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
PATCH /baseUrl/teams/:teamId/memberships/:membershipId/status HTTP/1.1
X-Appwrite-Jwt: {{apiKey}}
Content-Type: application/json
Host: example.com
Content-Length: 34
{
"secret": "",
"userId": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PATCH", "{{baseUrl}}/teams/:teamId/memberships/:membershipId/status")
.setHeader("x-appwrite-jwt", "{{apiKey}}")
.setHeader("content-type", "application/json")
.setBody("{\n \"secret\": \"\",\n \"userId\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/teams/:teamId/memberships/:membershipId/status"))
.header("x-appwrite-jwt", "{{apiKey}}")
.header("content-type", "application/json")
.method("PATCH", HttpRequest.BodyPublishers.ofString("{\n \"secret\": \"\",\n \"userId\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"secret\": \"\",\n \"userId\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/teams/:teamId/memberships/:membershipId/status")
.patch(body)
.addHeader("x-appwrite-jwt", "{{apiKey}}")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.patch("{{baseUrl}}/teams/:teamId/memberships/:membershipId/status")
.header("x-appwrite-jwt", "{{apiKey}}")
.header("content-type", "application/json")
.body("{\n \"secret\": \"\",\n \"userId\": \"\"\n}")
.asString();
const data = JSON.stringify({
secret: '',
userId: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PATCH', '{{baseUrl}}/teams/:teamId/memberships/:membershipId/status');
xhr.setRequestHeader('x-appwrite-jwt', '{{apiKey}}');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PATCH',
url: '{{baseUrl}}/teams/:teamId/memberships/:membershipId/status',
headers: {'x-appwrite-jwt': '{{apiKey}}', 'content-type': 'application/json'},
data: {secret: '', userId: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/teams/:teamId/memberships/:membershipId/status';
const options = {
method: 'PATCH',
headers: {'x-appwrite-jwt': '{{apiKey}}', 'content-type': 'application/json'},
body: '{"secret":"","userId":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/teams/:teamId/memberships/:membershipId/status',
method: 'PATCH',
headers: {
'x-appwrite-jwt': '{{apiKey}}',
'content-type': 'application/json'
},
processData: false,
data: '{\n "secret": "",\n "userId": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"secret\": \"\",\n \"userId\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/teams/:teamId/memberships/:membershipId/status")
.patch(body)
.addHeader("x-appwrite-jwt", "{{apiKey}}")
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'PATCH',
hostname: 'example.com',
port: null,
path: '/baseUrl/teams/:teamId/memberships/:membershipId/status',
headers: {
'x-appwrite-jwt': '{{apiKey}}',
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({secret: '', userId: ''}));
req.end();
const request = require('request');
const options = {
method: 'PATCH',
url: '{{baseUrl}}/teams/:teamId/memberships/:membershipId/status',
headers: {'x-appwrite-jwt': '{{apiKey}}', 'content-type': 'application/json'},
body: {secret: '', userId: ''},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('PATCH', '{{baseUrl}}/teams/:teamId/memberships/:membershipId/status');
req.headers({
'x-appwrite-jwt': '{{apiKey}}',
'content-type': 'application/json'
});
req.type('json');
req.send({
secret: '',
userId: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'PATCH',
url: '{{baseUrl}}/teams/:teamId/memberships/:membershipId/status',
headers: {'x-appwrite-jwt': '{{apiKey}}', 'content-type': 'application/json'},
data: {secret: '', userId: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/teams/:teamId/memberships/:membershipId/status';
const options = {
method: 'PATCH',
headers: {'x-appwrite-jwt': '{{apiKey}}', 'content-type': 'application/json'},
body: '{"secret":"","userId":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-appwrite-jwt": @"{{apiKey}}",
@"content-type": @"application/json" };
NSDictionary *parameters = @{ @"secret": @"",
@"userId": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/teams/:teamId/memberships/:membershipId/status"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"PATCH"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/teams/:teamId/memberships/:membershipId/status" in
let headers = Header.add_list (Header.init ()) [
("x-appwrite-jwt", "{{apiKey}}");
("content-type", "application/json");
] in
let body = Cohttp_lwt_body.of_string "{\n \"secret\": \"\",\n \"userId\": \"\"\n}" in
Client.call ~headers ~body `PATCH uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/teams/:teamId/memberships/:membershipId/status",
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([
'secret' => '',
'userId' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json",
"x-appwrite-jwt: {{apiKey}}"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('PATCH', '{{baseUrl}}/teams/:teamId/memberships/:membershipId/status', [
'body' => '{
"secret": "",
"userId": ""
}',
'headers' => [
'content-type' => 'application/json',
'x-appwrite-jwt' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/teams/:teamId/memberships/:membershipId/status');
$request->setMethod(HttpRequest::HTTP_METH_PATCH);
$request->setHeaders([
'x-appwrite-jwt' => '{{apiKey}}',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'secret' => '',
'userId' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'secret' => '',
'userId' => ''
]));
$request->setRequestUrl('{{baseUrl}}/teams/:teamId/memberships/:membershipId/status');
$request->setRequestMethod('PATCH');
$request->setBody($body);
$request->setHeaders([
'x-appwrite-jwt' => '{{apiKey}}',
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-appwrite-jwt", "{{apiKey}}")
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/teams/:teamId/memberships/:membershipId/status' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"secret": "",
"userId": ""
}'
$headers=@{}
$headers.Add("x-appwrite-jwt", "{{apiKey}}")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/teams/:teamId/memberships/:membershipId/status' -Method PATCH -Headers $headers -ContentType 'application/json' -Body '{
"secret": "",
"userId": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"secret\": \"\",\n \"userId\": \"\"\n}"
headers = {
'x-appwrite-jwt': "{{apiKey}}",
'content-type': "application/json"
}
conn.request("PATCH", "/baseUrl/teams/:teamId/memberships/:membershipId/status", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/teams/:teamId/memberships/:membershipId/status"
payload = {
"secret": "",
"userId": ""
}
headers = {
"x-appwrite-jwt": "{{apiKey}}",
"content-type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/teams/:teamId/memberships/:membershipId/status"
payload <- "{\n \"secret\": \"\",\n \"userId\": \"\"\n}"
encode <- "json"
response <- VERB("PATCH", url, body = payload, add_headers('x-appwrite-jwt' = '{{apiKey}}'), content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/teams/:teamId/memberships/:membershipId/status")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["x-appwrite-jwt"] = '{{apiKey}}'
request["content-type"] = 'application/json'
request.body = "{\n \"secret\": \"\",\n \"userId\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.patch('/baseUrl/teams/:teamId/memberships/:membershipId/status') do |req|
req.headers['x-appwrite-jwt'] = '{{apiKey}}'
req.body = "{\n \"secret\": \"\",\n \"userId\": \"\"\n}"
end
puts response.status
puts response.body
use std::str::FromStr;
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/teams/:teamId/memberships/:membershipId/status";
let payload = json!({
"secret": "",
"userId": ""
});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-appwrite-jwt", "{{apiKey}}".parse().unwrap());
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("PATCH").unwrap(), url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request PATCH \
--url {{baseUrl}}/teams/:teamId/memberships/:membershipId/status \
--header 'content-type: application/json' \
--header 'x-appwrite-jwt: {{apiKey}}' \
--data '{
"secret": "",
"userId": ""
}'
echo '{
"secret": "",
"userId": ""
}' | \
http PATCH {{baseUrl}}/teams/:teamId/memberships/:membershipId/status \
content-type:application/json \
x-appwrite-jwt:'{{apiKey}}'
wget --quiet \
--method PATCH \
--header 'x-appwrite-jwt: {{apiKey}}' \
--header 'content-type: application/json' \
--body-data '{\n "secret": "",\n "userId": ""\n}' \
--output-document \
- {{baseUrl}}/teams/:teamId/memberships/:membershipId/status
import Foundation
let headers = [
"x-appwrite-jwt": "{{apiKey}}",
"content-type": "application/json"
]
let parameters = [
"secret": "",
"userId": ""
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/teams/:teamId/memberships/:membershipId/status")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PATCH"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()
PUT
Update Team
{{baseUrl}}/teams/:teamId
HEADERS
X-Appwrite-JWT
{{apiKey}}
QUERY PARAMS
teamId
BODY json
{
"name": ""
}
Examples
REQUEST
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PUT");
curl_easy_setopt(hnd, CURLOPT_URL, "{{baseUrl}}/teams/:teamId");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "x-appwrite-jwt: {{apiKey}}");
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\n \"name\": \"\"\n}");
CURLcode ret = curl_easy_perform(hnd);
(require '[clj-http.client :as client])
(client/put "{{baseUrl}}/teams/:teamId" {:headers {:x-appwrite-jwt "{{apiKey}}"}
:content-type :json
:form-params {:name ""}})
require "http/client"
url = "{{baseUrl}}/teams/:teamId"
headers = HTTP::Headers{
"x-appwrite-jwt" => "{{apiKey}}"
"content-type" => "application/json"
}
reqBody = "{\n \"name\": \"\"\n}"
response = HTTP::Client.put url, headers: headers, body: reqBody
puts response.body
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Put,
RequestUri = new Uri("{{baseUrl}}/teams/:teamId"),
Headers =
{
{ "x-appwrite-jwt", "{{apiKey}}" },
},
Content = new StringContent("{\n \"name\": \"\"\n}")
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
var client = new RestClient("{{baseUrl}}/teams/:teamId");
var request = new RestRequest("", Method.Put);
request.AddHeader("x-appwrite-jwt", "{{apiKey}}");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\n \"name\": \"\"\n}", ParameterType.RequestBody);
var response = client.Execute(request);
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "{{baseUrl}}/teams/:teamId"
payload := strings.NewReader("{\n \"name\": \"\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("x-appwrite-jwt", "{{apiKey}}")
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
PUT /baseUrl/teams/:teamId HTTP/1.1
X-Appwrite-Jwt: {{apiKey}}
Content-Type: application/json
Host: example.com
Content-Length: 16
{
"name": ""
}
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PUT", "{{baseUrl}}/teams/:teamId")
.setHeader("x-appwrite-jwt", "{{apiKey}}")
.setHeader("content-type", "application/json")
.setBody("{\n \"name\": \"\"\n}")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("{{baseUrl}}/teams/:teamId"))
.header("x-appwrite-jwt", "{{apiKey}}")
.header("content-type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString("{\n \"name\": \"\"\n}"))
.build();
HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"name\": \"\"\n}");
Request request = new Request.Builder()
.url("{{baseUrl}}/teams/:teamId")
.put(body)
.addHeader("x-appwrite-jwt", "{{apiKey}}")
.addHeader("content-type", "application/json")
.build();
Response response = client.newCall(request).execute();
HttpResponse response = Unirest.put("{{baseUrl}}/teams/:teamId")
.header("x-appwrite-jwt", "{{apiKey}}")
.header("content-type", "application/json")
.body("{\n \"name\": \"\"\n}")
.asString();
const data = JSON.stringify({
name: ''
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PUT', '{{baseUrl}}/teams/:teamId');
xhr.setRequestHeader('x-appwrite-jwt', '{{apiKey}}');
xhr.setRequestHeader('content-type', 'application/json');
xhr.send(data);
import axios from 'axios';
const options = {
method: 'PUT',
url: '{{baseUrl}}/teams/:teamId',
headers: {'x-appwrite-jwt': '{{apiKey}}', 'content-type': 'application/json'},
data: {name: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const url = '{{baseUrl}}/teams/:teamId';
const options = {
method: 'PUT',
headers: {'x-appwrite-jwt': '{{apiKey}}', 'content-type': 'application/json'},
body: '{"name":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
const settings = {
async: true,
crossDomain: true,
url: '{{baseUrl}}/teams/:teamId',
method: 'PUT',
headers: {
'x-appwrite-jwt': '{{apiKey}}',
'content-type': 'application/json'
},
processData: false,
data: '{\n "name": ""\n}'
};
$.ajax(settings).done(function (response) {
console.log(response);
});
val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"name\": \"\"\n}")
val request = Request.Builder()
.url("{{baseUrl}}/teams/:teamId")
.put(body)
.addHeader("x-appwrite-jwt", "{{apiKey}}")
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()
const http = require('https');
const options = {
method: 'PUT',
hostname: 'example.com',
port: null,
path: '/baseUrl/teams/:teamId',
headers: {
'x-appwrite-jwt': '{{apiKey}}',
'content-type': 'application/json'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.write(JSON.stringify({name: ''}));
req.end();
const request = require('request');
const options = {
method: 'PUT',
url: '{{baseUrl}}/teams/:teamId',
headers: {'x-appwrite-jwt': '{{apiKey}}', 'content-type': 'application/json'},
body: {name: ''},
json: true
};
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
const unirest = require('unirest');
const req = unirest('PUT', '{{baseUrl}}/teams/:teamId');
req.headers({
'x-appwrite-jwt': '{{apiKey}}',
'content-type': 'application/json'
});
req.type('json');
req.send({
name: ''
});
req.end(function (res) {
if (res.error) throw new Error(res.error);
console.log(res.body);
});
const axios = require('axios').default;
const options = {
method: 'PUT',
url: '{{baseUrl}}/teams/:teamId',
headers: {'x-appwrite-jwt': '{{apiKey}}', 'content-type': 'application/json'},
data: {name: ''}
};
try {
const { data } = await axios.request(options);
console.log(data);
} catch (error) {
console.error(error);
}
const fetch = require('node-fetch');
const url = '{{baseUrl}}/teams/:teamId';
const options = {
method: 'PUT',
headers: {'x-appwrite-jwt': '{{apiKey}}', 'content-type': 'application/json'},
body: '{"name":""}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
#import
NSDictionary *headers = @{ @"x-appwrite-jwt": @"{{apiKey}}",
@"content-type": @"application/json" };
NSDictionary *parameters = @{ @"name": @"" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"{{baseUrl}}/teams/:teamId"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"PUT"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "{{baseUrl}}/teams/:teamId" in
let headers = Header.add_list (Header.init ()) [
("x-appwrite-jwt", "{{apiKey}}");
("content-type", "application/json");
] in
let body = Cohttp_lwt_body.of_string "{\n \"name\": \"\"\n}" in
Client.call ~headers ~body `PUT uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
"{{baseUrl}}/teams/:teamId",
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' => ''
]),
CURLOPT_HTTPHEADER => [
"content-type: application/json",
"x-appwrite-jwt: {{apiKey}}"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
request('PUT', '{{baseUrl}}/teams/:teamId', [
'body' => '{
"name": ""
}',
'headers' => [
'content-type' => 'application/json',
'x-appwrite-jwt' => '{{apiKey}}',
],
]);
echo $response->getBody();
setUrl('{{baseUrl}}/teams/:teamId');
$request->setMethod(HTTP_METH_PUT);
$request->setHeaders([
'x-appwrite-jwt' => '{{apiKey}}',
'content-type' => 'application/json'
]);
$request->setContentType('application/json');
$request->setBody(json_encode([
'name' => ''
]));
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
append(json_encode([
'name' => ''
]));
$request->setRequestUrl('{{baseUrl}}/teams/:teamId');
$request->setRequestMethod('PUT');
$request->setBody($body);
$request->setHeaders([
'x-appwrite-jwt' => '{{apiKey}}',
'content-type' => 'application/json'
]);
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();
$headers=@{}
$headers.Add("x-appwrite-jwt", "{{apiKey}}")
$headers.Add("content-type", "application/json")
$response = Invoke-WebRequest -Uri '{{baseUrl}}/teams/:teamId' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"name": ""
}'
$headers=@{}
$headers.Add("x-appwrite-jwt", "{{apiKey}}")
$headers.Add("content-type", "application/json")
$response = Invoke-RestMethod -Uri '{{baseUrl}}/teams/:teamId' -Method PUT -Headers $headers -ContentType 'application/json' -Body '{
"name": ""
}'
import http.client
conn = http.client.HTTPSConnection("example.com")
payload = "{\n \"name\": \"\"\n}"
headers = {
'x-appwrite-jwt': "{{apiKey}}",
'content-type': "application/json"
}
conn.request("PUT", "/baseUrl/teams/:teamId", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
import requests
url = "{{baseUrl}}/teams/:teamId"
payload = { "name": "" }
headers = {
"x-appwrite-jwt": "{{apiKey}}",
"content-type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.json())
library(httr)
url <- "{{baseUrl}}/teams/:teamId"
payload <- "{\n \"name\": \"\"\n}"
encode <- "json"
response <- VERB("PUT", url, body = payload, add_headers('x-appwrite-jwt' = '{{apiKey}}'), content_type("application/json"), encode = encode)
content(response, "text")
require 'uri'
require 'net/http'
url = URI("{{baseUrl}}/teams/:teamId")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["x-appwrite-jwt"] = '{{apiKey}}'
request["content-type"] = 'application/json'
request.body = "{\n \"name\": \"\"\n}"
response = http.request(request)
puts response.read_body
require 'faraday'
conn = Faraday.new(
url: 'https://example.com',
headers: {'Content-Type' => 'application/json'}
)
response = conn.put('/baseUrl/teams/:teamId') do |req|
req.headers['x-appwrite-jwt'] = '{{apiKey}}'
req.body = "{\n \"name\": \"\"\n}"
end
puts response.status
puts response.body
use std::str::FromStr;
use serde_json::json;
use reqwest;
#[tokio::main]
pub async fn main() {
let url = "{{baseUrl}}/teams/:teamId";
let payload = json!({"name": ""});
let mut headers = reqwest::header::HeaderMap::new();
headers.insert("x-appwrite-jwt", "{{apiKey}}".parse().unwrap());
headers.insert("content-type", "application/json".parse().unwrap());
let client = reqwest::Client::new();
let response = client.request(reqwest::Method::from_str("PUT").unwrap(), url)
.headers(headers)
.json(&payload)
.send()
.await;
let results = response.unwrap()
.json::()
.await
.unwrap();
dbg!(results);
}
curl --request PUT \
--url {{baseUrl}}/teams/:teamId \
--header 'content-type: application/json' \
--header 'x-appwrite-jwt: {{apiKey}}' \
--data '{
"name": ""
}'
echo '{
"name": ""
}' | \
http PUT {{baseUrl}}/teams/:teamId \
content-type:application/json \
x-appwrite-jwt:'{{apiKey}}'
wget --quiet \
--method PUT \
--header 'x-appwrite-jwt: {{apiKey}}' \
--header 'content-type: application/json' \
--body-data '{\n "name": ""\n}' \
--output-document \
- {{baseUrl}}/teams/:teamId
import Foundation
let headers = [
"x-appwrite-jwt": "{{apiKey}}",
"content-type": "application/json"
]
let parameters = ["name": ""] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "{{baseUrl}}/teams/:teamId")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error as Any)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()