# Module cloudi_json_rpc

- Description
- Data Types
- Function Index
- Function Details

### CloudI JSON RPC

Implementation based on the version 2.0 of the JSON-RPC specification.

Copyright © 2011-2020 Michael Truog

Version: 2.0.1 May 26 2021 20:06:32 ------------------------------------------------------------------------

Authors: Michael Truog (`mjtruog at protonmail dot com`).

## Description

### CloudI JSON RPC

Implementation based on the version 2.0 of the JSON-RPC specification. Named parameters are not supported to ensure parameters always have an implicit order. Batch requests are not supported.

## Data Types

### error_code()

`error_code() = integer()`

### error_message()

`error_message() = binary()`

### id()

`id() = binary() | integer() | null`

### method()

`method() = binary()`

### params()

`params() = list()`

### result()

`result() = any()`

## Function Index

error_internal_error/1 | #### Internal JSON-RPC error. .
error_invalid_params/1 | #### Invalid method parameter(s). .
error_invalid_request/0 | #### The JSON sent is not a valid Request object. .
error_method_not_found/1 | #### The method does not exist / is not available. .
error_parsing/0 | #### Invalid JSON was received by the server. .
request_to_json/2 | #### Create a JSON-RPC request in a JSON binary. .
request_to_json/3 | #### Create a JSON-RPC request with parameters in a JSON binary. .
request_to_term/1 | #### Parse a JSON-RPC request to create Erlang terms. .
response_to_json/2 | #### Create a JSON-RPC response in a JSON binary. .
response_to_json/4 | #### Create a JSON-RPC error response in a JSON binary. .
response_to_term/1 | #### Parse a JSON-RPC response to create Erlang terms. .

## Function Details

### error_internal_error/1

`error_internal_error(Id::id()) -> binary()`

#### Internal JSON-RPC error.

### error_invalid_params/1

`error_invalid_params(Id::id()) -> binary()`

#### Invalid method parameter(s).

### error_invalid_request/0

`error_invalid_request() -> binary()`

#### The JSON sent is not a valid Request object.

### error_method_not_found/1

`error_method_not_found(Id::id()) -> binary()`

#### The method does not exist / is not available.

### error_parsing/0

`error_parsing() -> binary()`

#### Invalid JSON was received by the server.

### request_to_json/2

`request_to_json(Method::atom() | string() | binary(), Id::id()) -> binary()`

#### Create a JSON-RPC request in a JSON binary.

### request_to_json/3

`request_to_json(Method::atom() | string() | binary(), Params::params(), Id::id()) -> binary()`

#### Create a JSON-RPC request with parameters in a JSON binary.

### request_to_term/1

`request_to_term(Data::binary()) -> {method(), params(), id()}`

#### Parse a JSON-RPC request to create Erlang terms.

### response_to_json/2

`response_to_json(Result::result(), Id::id()) -> binary()`

#### Create a JSON-RPC response in a JSON binary.

### response_to_json/4

`response_to_json(Result::result() | null, ErrorCode::error_code() | null, ErrorMessage::error_message() | null, Id::id()) -> binary()`

#### Create a JSON-RPC error response in a JSON binary.

### response_to_term/1

`response_to_term(Data::binary()) -> {result(), error_code() | null, error_message() | null, id()}`

#### Parse a JSON-RPC response to create Erlang terms.

Generated by EDoc