Lime Web Components API Documentation - v7.4.0
    Preparing search index...

    Interface HttpOptions

    Configuration options for HTTP requests

    import {
    HttpOptions,
    PlatformServiceName,
    } from '@limetech/lime-web-components';

    const http = platform.get(PlatformServiceName.Http);

    const options: HttpOptions = {
    params: { search: 'John', limit: '10' },
    headers: { 'X-Custom-Header': 'value' },
    responseType: 'json',
    };

    const users = await http.get('my_addon/users', options);
    interface HttpOptions {
        headers?: HttpHeaders;
        params?: HttpParams;
        responseType?: HttpResponseType;
    }
    Index

    Properties

    headers?: HttpHeaders

    Additional HTTP headers to include in the request

    import {
    HttpHeaders,
    PlatformServiceName,
    } from '@limetech/lime-web-components';

    const http = platform.get(PlatformServiceName.Http);

    const headers: HttpHeaders = {
    Authorization: 'Bearer token123',
    'Accept-Language': 'en-US',
    };

    const data = await http.get('my_addon/endpoint', { headers });
    params?: HttpParams

    Query parameters to append to the URL

    Parameters will be URL-encoded and appended to the request URL.

    import { HttpParams, PlatformServiceName } from '@limetech/lime-web-components';

    const http = platform.get(PlatformServiceName.Http);

    const params: HttpParams = {
    active: 'true',
    role: ['admin', 'user'],
    };

    // Requests my_addon/users?active=true&role=admin&role=user
    const users = await http.get('my_addon/users', { params });
    responseType?: HttpResponseType

    Expected response data type. Defaults to 'json'

    • json: Parse response as JSON (default)
    • text: Get response as plain text string
    • blob: Get response as binary Blob (for file downloads)
    • arraybuffer: Get response as ArrayBuffer (for binary data processing)
    import { PlatformServiceName } from '@limetech/lime-web-components';

    const http = platform.get(PlatformServiceName.Http);

    const report: Blob = await http.get('my_addon/report.pdf', {
    responseType: 'blob',
    });

    const url = URL.createObjectURL(report);
    window.open(url);