/RestClient.jl

Mirror of https://code.tecosaur.net/tec/RestClient.jl

Primary LanguageJuliaMozilla Public License 2.0MPL-2.0

RestClient.jl

Simplify the process of interacting with RESTful APIs with concise but capable utilities for defining endpoints, request handling, and response parsing. This package aims to absorb as much of the common complexity of interfacing with an API as possible, and provide sensible OOTB behaviour with minimal setup.

See the docs’ tutorial for a guided example on how to write a client with this package.

Features

Minimal Boilerplate
Defining an API endpoint can take just a single line of code.
Built-in common functionality
Debugging utilities, input URI encoding, and rate limiting.
Easy serialisation
Straightforward interoperability with JSON3 and XML via @jsondef and @xmldef.
Flexibility
Extensible to support custom serialisation formats, complex requests, and more.

Example

using RestClient, JSON3

@globalconfig RequestConfig("https://api.sampleapis.com/coffee")

@jsondef struct Coffee
    title::String
    description::String
    ingredients::Vector{String}
    image::String
    id::Int
end

@endpoint hot() -> "hot" -> Vector{Coffee}
@endpoint iced() -> "iced" -> Vector{Coffee}