API Reference

Introduction

The ValueA API uses the following HTTP Request Methods:

  • GET Retrieves data

  • PUT DELETE POST Update/delete/create data or executes an action

The following structure is used:

https://<host>/api/<module>/<controller>/<command>/[<param1>/[<param2>/...]]

The body of the HTTP POST request and response is an ‘application/json’ object.

The $key and $secret parameters are used to pass the API credentials using curl. You need to set these parameters with your own API credentials before using them in the examples:

key=DtfINvk9nObnLcw3/mHgwF4+wsJgqYvXoBIUSAvHfTnaJOTdhvwl27geGfpN28ehuDnh1664Au/n2NZq
secret=r9jKG+KqjhmDkRuzWGPQIyRwC3oUsi/QahngQxDKuFNz8xOY7n0VlRahk+3WPnXlAp8S5lDUh8xfeKIa

Example

Python example executing a POST test service in module valueacore in the test controller

call_test_service.py
 1import json
 2import requests
 3import datetime
 4
 5api_key = 'DtfINvk9nObnLcw3/mHgwF4+wsJgqYvXoBIUSAvHfTnaJOTdhvwl27geGfpN28ehuDnh1664Au/n2NZq'
 6api_secret = 'r9jKG+KqjhmDkRuzWGPQIyRwC3oUsi/QahngQxDKuFNz8xOY7n0VlRahk+3WPnXlAp8S5lDUh8xfeKIa'
 7url = 'http://localhost:8000/api/valueacore/test/test/'
 8headers = {'Content-type': 'application/json', 'Accept': 'text/plain'}
 9payload = {'send': str(datetime.datetime.now())}
10
11req = requests.post(url=url,
12                    data=json.dumps(payload),
13                    auth=(api_key, api_secret),
14                    verify=False,
15                    headers=headers
16                    )
17
18if req.status_code == 200:
19    print('ret: %s' % req.text)
20else:
21    print(req.status_code, req.reason, req.text)

Note

This example uses verify=false, which will ignore the SSL trust relation. In production environments you don’t want to do this (either make sure there’s a valid certificate installed or use the expected public key in your request).