REST method type

The REST method that the app provides. REST methods can be used by other objects in this manifest, including dashboard items, GUI actions, and metadata providers.

IBM® QRadar® expects the response of a REST method to be RFC 4627-compliant JSON (https://www.ietf.org/rfc/rfc4627.txt). Arguments are passed to the method either as a query string argument or URI encoded parameters in the PUT or POST body.

REST methods are typically implemented in Python by using the Flask framework.

The following implementation of a REST method retrieves a type of metadata:

@app.route('/getMetaData', methods=['GET'])
def getMetaData(): 
    ip = request.args.get("ip")
    #Do something with this IP and populate a variable called 'value'
    return json.dumps({'key':'myMetaData','label':'Item Label','value':value})

This method is then exposed in the manifest in the following way:

...

rest_methods: [
       {
            "name":"getMetaData",
            "url":"/getMetaData",
            "method":"GET",
            "argument_names":["context"]
       }
    ],

...

The following table describes the Rest_methods block fields in the manifest.json file.

Table 1. Rest_methods block fields
Field Required Type Description
name Yes String A unique name for this REST method within the app.
method Yes String An HTTP method on named endpoint (GET/POST/DELETE/PUT).
url Yes String The URL to access the REST method, relative to the app root. Only URLs within the app are supported.
argument_names No String The names of arguments that this method expects. Arguments that are passed to the method are URL-encoded, as either query string parameters or in the PUT or POST body.
required_capabilities No Array of String A set of capabilities that a user must affiliate with their user role to access this method.