Performs an HTTP POST request
Works similarly to axios
Notes: Only HTTPS requests are accepted
You can pass an authentication header through the headers field
Example:
Eitri.http.post('https://myaddress.com',
{
myData: "value of my data"
},
{
"headers": {"Content-Type": "application/json"}
}
)
- API LEVEL
1
- Functionality added- API LEVEL
3
- Adds support for multipart/form-data- API LEVEL
12
- Adds support for application/x-www-form-urlencoded
HTTP address for the request
Optional
data: anyData to be sent
Optional
config: HttpConfigAdditional configurations for the request
Performs an HTTP GET request
Works similarly to axios
Notes:
Only HTTPS requests are accepted
You can pass an authentication header through the headers
Example:
Eitri.http.get('https://myaddress.com')
- API LEVEL
1
- Functionality added
HTTP address for the request
Optional
config: HttpConfigAdditional configurations for the request
Performs an HTTP DELETE request
Works similarly to axios
Notes: Only HTTPS requests are accepted
You can pass an authentication header through the headers
Example:
Eitri.http.delete('https://myaddress.com', { "headers": { "Content-Type": "application/json" } } )
- API LEVEL
1
- Functionality added
HTTP address for the request
Optional
config: HttpConfigAdditional configurations for the request
Performs an HTTP PUT request
Works similarly to axios
Notes: Only HTTPS requests are accepted
You can pass an authentication header through the headers
Example:
Eitri.http.put('https://myaddress.com',
{
myData: "value of my data"
},
{
"headers": {"Content-Type": "application/json"}
}
)
- API LEVEL
1
- Functionality added- API LEVEL
3
- Adds support for multipart/form-data- API LEVEL
12
- Adds support for application/x-www-form-urlencoded
HTTP address for the request
Optional
data: anyData to be sent
Optional
config: HttpConfigAdditional configurations for the request
Performs an HTTP PATCH request
Works similarly to axios
Notes: Only HTTPS requests are accepted
You can pass an authentication header through the headers
Example:
Eitri.http.patch('https://myaddress.com',
{
myData: "value of my data"
},
{
"headers": {"Content-Type": "application/json"}
}
)
- API LEVEL
1
- Functionality added- API LEVEL
3
- Adds support for multipart/form-data- API LEVEL
12
- Adds support for application/x-www-form-urlencoded
HTTP address for the request
Optional
data: anyData to be sent
Optional
config: HttpConfigAdditional configurations for the request
Performs an HTTP HEAD request
Works similarly to axios
Notes: Only HTTPS requests are accepted
You can pass an authentication header through the headers
Example:
Eitri.http.head('https://myaddress.com', {"headers": {"Content-Type": "application/json"}})
- API LEVEL
1
- Functionality added
HTTP address for the request
Optional
config: HttpConfigAdditional configurations for the request
Performs an HTTP OPTIONS request
Works similarly to axios
Notes: Only HTTPS requests are accepted
You can pass an authentication header through the headers
Example:
Eitri.http.options('https://myaddress.com', { "headers": { "Content-Type": "application/json" } } )
- API LEVEL
1
- Functionality added
HTTP address for the request
Optional
config: HttpConfigAdditional configurations for the request
Performs a general purpose HTTP request using Axios syntax
Works similarly to axios
Notes: Only HTTPS requests are accepted
Example:
const requestConfig = {
url: "https://myaddress.com",
method: "POST",
headers: { "Content-Type": "application/json" },
timeout: 5000,
data: { foo: "bar"},
}
Eitri.http.request(requestConfig)
- API LEVEL
1
- Functionality added
Axios-like request configuration
Downloads a file using HTTP and stores it on the device.
Allowed Extensions:
[
"txt", // Plain Text
"rtf", // Rich Text Format
"pdf", // PDF - Portable Document Format
"md", // Markdown
"xls", "xlsx", // Microsoft Excel
"csv", // CSV - Comma-Separated Values
"gsheet", // Google Sheets
"ppt", "pptx", // Microsoft PowerPoint
"doc", "docx", // Microsoft Word
"gdoc", // Google Docs
"jpg", "jpeg", // JPEG Image
"png", // PNG Image
"gif", // GIF Image
"mp3", // MP3 Audio
"wav", // WAV Audio
"mp4", // MP4 Video
"avi", // AVI Video
"zip", // ZIP Archive
"rar", // RAR Archive
"epub", // EPUB Ebook
"mobi", // Kindle Ebook
"key", // Adobe Acrobat Keynote (for Apple Keynote presentations)
"pages", // Apple Pages
"numbers", // Apple Numbers
"keynote" // Apple Keynote
]
Example:
await Eitri.fs.download({
url: "https://domain.com/file-to-download",
fileName: "invoice-02-2023.pdf",
})
- API LEVEL
4
- Functionality added
Uploads a file to a server using HTTP.
Example:
let files = await Eitri.fs.openImagePicker({
fileExtension: ["jpg", "png"],
allowsMultipleSelection: false
});
if(files.length > 0){
let file = files[0]
// raw upload
await Eitri.http.upload({
url: "https://domain.com/upload",
method: "POST",
file: file,
config: {
headers: {
"Content-Type": file.mimeType
}
}
});
// multipart/form-data upload
await Eitri.http.upload({
url: "https://domain.com/upload",
method: "POST",
multipartData: [
{field: "firstName", value: "Upload"},
{field: "lastName", value: "Test"},
{field: "file", file: file}
],
config: {
headers: {
"AAA": "BBB"
}
}
});
}
- API LEVEL
24
- Functionality added
Performs a general purpose HTTP request using fetch syntax
Works similarly to fetch
Notes:
Only HTTPS requests are accepted
Signals are not supported, use timeout property
Example:
Eitri.http.fetch("https://myaddress.com", {
method: "POST",
body: { foo: "bar"},
timeout: 1000 * 5,
})
- API LEVEL
1
- Functionality added
Optional
fetchConfig: FetchRequestConfigGenerated using TypeDoc
Set of methods for operating HTTP requests