Attachments
Get attachment options
Handles CORS preflight requests for attachment document access
OPTIONS
/
v1
/
attachments
/
{attachmentId}
/
document
Get attachment options
curl --request OPTIONS \
--url https://api.light.inc/v1/attachments/{attachmentId}/document \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json;charset=UTF-8' \
--data '
{
"roles": [
"<string>"
],
"name": "<string>"
}
'import requests
url = "https://api.light.inc/v1/attachments/{attachmentId}/document"
payload = {
"roles": ["<string>"],
"name": "<string>"
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json;charset=UTF-8"
}
response = requests.options(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'OPTIONS',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json;charset=UTF-8'},
body: JSON.stringify({roles: ['<string>'], name: '<string>'})
};
fetch('https://api.light.inc/v1/attachments/{attachmentId}/document', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.light.inc/v1/attachments/{attachmentId}/document",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "OPTIONS",
CURLOPT_POSTFIELDS => json_encode([
'roles' => [
'<string>'
],
'name' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json;charset=UTF-8"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.light.inc/v1/attachments/{attachmentId}/document"
payload := strings.NewReader("{\n \"roles\": [\n \"<string>\"\n ],\n \"name\": \"<string>\"\n}")
req, _ := http.NewRequest("OPTIONS", url, payload)
req.Header.Add("Authorization", "<api-key>")
req.Header.Add("Content-Type", "application/json;charset=UTF-8")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.options("https://api.light.inc/v1/attachments/{attachmentId}/document")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json;charset=UTF-8")
.body("{\n \"roles\": [\n \"<string>\"\n ],\n \"name\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.light.inc/v1/attachments/{attachmentId}/document")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Options.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json;charset=UTF-8'
request.body = "{\n \"roles\": [\n \"<string>\"\n ],\n \"name\": \"<string>\"\n}"
response = http.request(request)
puts response.read_bodyAuthorizations
apiKeyAuthbearerAuth
Basic authentication header of the form Basic <api_key>, where <api_key> is your api key.
Path Parameters
Response
default - application/json;charset=UTF-8
default response
⌘I
Get attachment options
curl --request OPTIONS \
--url https://api.light.inc/v1/attachments/{attachmentId}/document \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json;charset=UTF-8' \
--data '
{
"roles": [
"<string>"
],
"name": "<string>"
}
'import requests
url = "https://api.light.inc/v1/attachments/{attachmentId}/document"
payload = {
"roles": ["<string>"],
"name": "<string>"
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json;charset=UTF-8"
}
response = requests.options(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'OPTIONS',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json;charset=UTF-8'},
body: JSON.stringify({roles: ['<string>'], name: '<string>'})
};
fetch('https://api.light.inc/v1/attachments/{attachmentId}/document', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.light.inc/v1/attachments/{attachmentId}/document",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "OPTIONS",
CURLOPT_POSTFIELDS => json_encode([
'roles' => [
'<string>'
],
'name' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json;charset=UTF-8"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.light.inc/v1/attachments/{attachmentId}/document"
payload := strings.NewReader("{\n \"roles\": [\n \"<string>\"\n ],\n \"name\": \"<string>\"\n}")
req, _ := http.NewRequest("OPTIONS", url, payload)
req.Header.Add("Authorization", "<api-key>")
req.Header.Add("Content-Type", "application/json;charset=UTF-8")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.options("https://api.light.inc/v1/attachments/{attachmentId}/document")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json;charset=UTF-8")
.body("{\n \"roles\": [\n \"<string>\"\n ],\n \"name\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.light.inc/v1/attachments/{attachmentId}/document")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Options.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json;charset=UTF-8'
request.body = "{\n \"roles\": [\n \"<string>\"\n ],\n \"name\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body