Construct A JSON-RPC API Call

To construct a functional call in your API program of choice, you need to:

  1. Ensure the start of the method includes the following, filling in your Visa with one received by running an authorization call:
    {
        "jsonrpc":"2.0",
        "visa": "{{visa}}",
        "id":"jsonrpc",
  2. Search in the schema for the method you need and add this to the call you are creating:
        "method" : "EnumerateAccountStatistics",
  3. Add the parameters and fill these in with the criteria you wish to search for:
        "params" : {
    	"query" : {
    	    "PartnerId" : partner-id-number-here,
    	    "StartRecordNumber" : number-of-records-to-start-displaying-from,
    	    "RecordsCount" : number-of-records-to-return,
    	    "Columns" : in-this-format-["xn","xn","xn"]-the-column-short-codes-to-display
    	}
        }
    }

      If a type is not int, bool, std::time_t, std::string or std::set<int>, then the type is either an enumeration, or structure and will be found by searching for the type in these sections. E.g. "AccountStatisticsQuery" with its accepted fields and types, is found in Structs.

    • If it is an enumeration (list) your API parameter should contain one or more of the given types
  4. Ensure you have closed the brackets and have commas at the end of lines which are followed by another parameter

The combined example query would look something like this:

{
    "jsonrpc":"2.0",
    "visa": "{{visa}}",
    "id":"jsonrpc",
    "method" : "EnumerateAccountStatistics",
    "params" : {
	"query" : {
	    "PartnerId" : 123456,
	    "StartRecordNumber" : 0,
	    "RecordsCount" : 5,
	    "Columns" : ["T3", "G3"]
	}
    }
}

For the above query, a sample response would be:

{
    "jsonrpc": "2.0",
    "id": "jsonrpc",
    "result": {
    	"result": [
	    {
		"AccountId": 987654,
		"Flags": [
		    "AutoDeployed"
		],
		"PartnerId": 123456,
		"Settings": null
	    },
	    {
		"AccountId": 987654,
		"Flags": [
    		"AutoDeployed"
		],
		"PartnerId": 123456,
		"Settings": [
	    {
			"T3": "248260085992"
		    }
		]
	    },
		"AccountId": 987654,
		"Flags": null,
		"PartnerId": 123456,
		"Settings": [
		    {
			"G3": "8094565"
		    }
		    {
			"T3": "29928402"
		    }
		]
	],
	"TotalStatistics": null
    },
    "visa": "{{visa}}"
}