Client side support for the REST API

Description

According to the OpenNMS Wiki (http://www.opennms.org/wiki/ReST), in order to get results in JSON format you have to send a "Accept: application/json" header.

By default a request to the API is returned in XML. To get JSON encoded responses one has to send the following header with the request: "Accept: application/json".

Instead I would like to see this done by using an URL parameter. As well as support for JSONP (JSON with Padding) >> http://en.wikipedia.org/wiki/JSONP

Example: /restAPIEndpoint?fmt=json&callback=parseJSON

This call would return data as follows

parseJSON({JSON_RESPONSE});

The response header from the API should also be 'Content-type: application/json' for example.

This would allow me to be able to dynamically write a script tag in a Javascript application which would return the payload to the callback handler when the script loads (REST API returns JSON data)

Therefore I would not need to use a server side script as a broker to make these API calls in my web applications.

https://mynms.opennms.com/Ticket/Display.html?id=3017

Environment

N/A

Acceptance / Success Criteria

None

Lucidchart Diagrams

Activity

Show:

Details

Assignee

Reporter

Components

Affects versions

Priority

PagerDuty

Created May 7, 2014 at 12:20 PM
Updated September 21, 2021 at 9:14 PM