Skip to main content
knowledgecenter.avangate.com

Overview

Introduction

Use JSON/RPC to invoke methods of version 3.0 of the Avangate API. JavaScript Object Notation remote procedure call protocol is a lightweight data-interchange format. 

Workflow

  1. Use the following URL: https://api.avangate.com/rpc/3.0/
  2. Authenticate using the login method and create a session (connection).
  3. Throughout the lifetime of the session (max 10 minutes) you can invoke all Avangate API methods. To invoke methods you need to send a request to Avangate. Read more on the request object below.
  4. The Avangate system provides responses for all requests. Read more on the response object below.

 

Request

Invoke remote methods by sending requests to Avangate. Request contain single objects serialized using JSON. Read request properties below.

{
    "jsonrpc": 2.0,
    "id": < intidentifier >,
    "method": "<methodName>",
    "params": [ < parametersarray > ]
    }

Request object

jsonrpc

required (String)

 

The version of the JSON-RPC protocol. Needs to be 2.0.

id

required (Int)

 

A mandatory identifier you control used to identify the request and the response. Use only integers.

method

required (String)

 

The name of the method invoked. Case sensitive.

params

optional (Object)

 

An object containing the parameters valid for invoking the method used.

Parameters structure:

  • Provide RPC call parameters by-position using an Array. (structured value)
  • by-position: include all parameters into an Array. Put values in the order expected by Avangate.
  • At this point Avangate doesn’t support by-name parameters.

Response

When the method invocation completes, Avangate replies with a response. The response is a single object serialized using JSON. There are two types of response, with the properties detailed below.

Valid

 

 {
    "id": < intidentifier > ,
    "jsonrpc": 2.0,
    "response": { < return object > }
                }

 

jsonrpc

required (String)

 

The version of the JSON-RPC protocol. Needs to be 2.0.

id

required (Int)

 

A mandatory identifier you control used to identify the request and the response. Use only integers.

response

required on success only (Object)

 

Provided on success (Avangate does not provide it if there is an error invoking the method). Actual value depends on the method invoked.

Invalid

{
    "id": < intidentifier >,
    "jsonrpc":2.0,
    "error":{
        "code": < interrorcode >,
        "message":"<error message>"
            }
    }

 

jsonrpc

required (String)

 

The version of the JSON-RPC protocol. Needs to be 2.0.

id

required (Int)

 

A mandatory identifier you control used to identify the request and the response. Use only integers.

error

required on error only (Object)

 

  • Code - Integer identifying the error.
  • Message - Error description (string).