I have tried sending "CreateElement" by Json but the response is 500 Internal Error.
Does DataMiner support Json format of this method?
The response is as belows.
{
"Message": "型 'System.String' のオブジェクトを型 'System.Int32[]' のオブジェクトに変換できません",
"StackTrace": " 場所 System.Web.Script.Serialization.ObjectConverter.ConvertObjectToTypeInternal(Object o, Type type, JavaScriptSerializer serializer, Boolean throwOnError, Object& convertedObject)\r\n 場所 System.Web.Script.Serialization.ObjectConverter.ConvertObjectToTypeMain(Object o, Type type, JavaScriptSerializer serializer, Boolean throwOnError, Object& convertedObject)\r\n 場所 System.Web.Script.Services.WebServiceMethodData.StrongTypeParameters(IDictionary`2 rawParams)\r\n 場所 System.Web.Script.Services.WebServiceMethodData.CallMethodFromRawParams(Object target, IDictionary`2 parameters)\r\n 場所 System.Web.Script.Services.RestHandler.InvokeMethod(HttpContext context, WebServiceMethodData methodData, IDictionary`2 rawParams)\r\n 場所 System.Web.Script.Services.RestHandler.ExecuteWebServiceCall(HttpContext context, WebServiceMethodData methodData)",
"ExceptionType": "System.InvalidOperationException"
}
The following is the request I send to DataMiner.
{
"connection":"10df979a-6bbd-412b-9182-66a38f0ec4eb",
"dmaID":"24202",
"viewIDs":"154",
"configuration":{
"Name":"APItest",
"Description":"",
"ProtocolName":"Microsoft Platform",
"protocolVersion":"5.0.0.2",
"Type":"Information Platform",
"AlarmTemplate":"",
"TrendTemplate":"",
"ForceAgent":"",
"IPAddress":"192.168.0.1",
"IPAddressMask":"255.255.255.0",
"CreateDVEs":"",
"EnableSnmpAgent":"",
"EnableTelnet":"",
"IsHidden":"",
"IsReadOnly":"",
"IsReplication":"",
"KeepOnline":"",
"SnmpReadCommunityString":"",
"SnmpWriteCommunityString":"",
"TimeoutTime":"1500",
"SlowPoll":"",
"State":"Stopped",
"Ports": {
"DMAElementBasePortInfo":{
"ElementTimeoutTime":"",
"TimeoutTime":"",
"Retries":""
}
}
}
}
Hi Tomoya,
I performed a small test using the driver (connector) Microsoft Platform and I was able to create the element using the following JSON message:
- URL: http://localhost/API/v1/json.asmx/CreateElement
- HTTP Method: POST
Headers:
- Content-Type: application/json
- host: localhost
Body:
{
"connection": "10df979a-6bbd-412b-9182-66a38f0ec4eb",
"dmaID": 24202,
"viewIDs":
[
154
],
"configuration":
{
"name": "TEST_MICROSOFT_ELEMENT",
"description": "Description Text",
"protocolName": "Microsoft Platform",
"protocolVersion": "Production",
"type": "Information Platform",
"ipAddress": "127.0.0.1",
"ports":
[
{
"__type": "Skyline.DataMiner.Web.Common.v1.DMAElementSerialPortInfo",
"ipAddress": "127.0.0.1",
"type": "tcp",
"retries": 0,
"timeoutTime": 1500,
"elementTimeoutTime": 30000
}
] }
}
I modified the following attributes according to your example:
- connection: "10df979a-6bbd-412b-9182-66a38f0ec4eb"
- dmaID: 24202
- ViewID: 154
Please could you test creating an element and let us know if it works for you?
DMA version used for tests: 10.1.3.0-9963
Thank you. It worked!