Module chewdata::connector::curl

source ·
Expand description

Read and write data through http(s) connector.

§Configuration

keyaliasDescriptionDefault ValuePossible Values
type-Required in order to use this connector.curlcurl
metadatametaOverride metadata information.nullcrate::Metadata
authenticatorauthDefine the authentification that secure the http(s) call.nullcrate::connector::authenticator::basic::Basic / crate::connector::authenticator::bearer::Bearer / crate::connector::authenticator::jwt::Jwt
endpoint-The http endpoint of the url like http://my_site.com:80.nullString
pathuriThe path of the resource.nullString
method-The http method to use.getHTTP methods
headers-The http headers to override.nullList of key/value
timeout-Time in secound before to abort the call.5Unsigned number
keepalive-Enable the TCP keepalive.truetrue / false
tcp_nodelay-Enable the TCP nodelay.falsetrue / false
parameters-Parameters used in the path that can be override.nullObject or Array of objects
paginator_typepaginatorPaginator parameters.crate::connector::paginator::curl::offset::Offsetcrate::connector::paginator::curl::offset::Offset / crate::connector::paginator::curl::cursor::Cursor
counter_typecount / counterUse to find the total of elements in the resource.nullcrate::connector::counter::curl::header::Header / crate::connector::counter::curl::body::Body
cache_modecacheEnable the backend cache management and define the cache strategy. See the details here https://github.com/06chaynes/http-cache/blob/main/http-cache/src/lib.rs#L265-L295nulldefault / no_store / reload / no_cache / force_cache / if_cached / ignore_rules
redirection_limit-Limit of redirection5Integer

§Examples

[
    {
        "type": "read",
        "connector":{
            "type": "curl",
            "endpoint": "{{ CURL_ENDPOINT }}",
            "path": "/get?skip={{ paginator.skip }}&limit={{ paginator.limit }}&cache={{ cache }}",
            "method": "get",
            "authenticator": {
                "type": "basic",
                "username": "{{ BASIC_USERNAME }}",
                "password": "{{ BASIC_PASSWORD }}",
            },
            "headers": {
                "Accept": "application/json"
            },
            "parameters": [
                { "cache": false }
            ],
            "paginator": {
                "limit": 100,
                "skip": 0
            },
            "cache_mode": "default"
        }
    }
]

Structs§