When adding access methods through the API doc, the API body will be pre-populated with the following.
[ { "customName":null, "port":null, "taskProperty":null, "type":null }
]
However, when the information is entered and "Try it out" is clicked, the response is a malformed JSON error.
Curl
curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' -d '[ \ { \ "customName":null, \ "port":22, \ "taskProperty":null, \ "type":SSH \ } \ ]' 'https://1.1.1.1/api.php/v1/devices.json/1111/accessMethods'
Response Body
{ "error": { "code": 400, "message": "Bad Request: Error parsing JSON, malformed JSON" } }
The malformed JSON error means that the format of the API call is incorrect.
In this case, the values for "port" and "type" do not have quotation marks around them. If the value is not null, quotation marks are required for the values.
Curl
curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' -d '[ \ { \ "customName":null, \ "port":"22", \ "taskProperty":null, \ "type":"SSH" \ } \ ]' 'https://1.1.1.1/api.php/v1/devices.json/1111/accessMethods'