cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1677
Views
1
Helpful
1
Replies

NSO REST API throwing error

Raja.Selvaraj
Level 4
Level 4

Hi ,

Trying to make POST call to add device entry in to the NSO but it is throwing the error for not recognizing ned-id "\"cisco-ios-xr-id:cisco-ios-xr\".

API : POST -> http://10.xxx.xx.xxx:8080/api/running/devices

Body:

{

  "device": [

    {

      "name": "s3cw-e-700",

      "address": "127.0.0.1",

      "port": 22,

      "authgroup": "default",

      "device-type": {

        "cli": {

          "ned-id": "cisco-ios-xr-id:cisco-ios-xr",

          "protocol": "ssh"

        }

      }

    }

  ]

Error:

{

    "errors": {

        "error": [

            {

                "error-message": "invalid value for: ned-id in /ncs:devices/ncs:device[ncs:name='s3cw-e-700']/ncs:device-type/ncs:cli/ncs:ned-id: \"cisco-ios-xr-id:cisco-ios-xr\" is not a valid value.",

                "error-urlpath": "/api/running/devices",

                "error-tag": "malformed-message"

            }

        ]

    }

}

}

Tried with the different combo but it doesn't work. As per my understanding, it is not recognizing the".

{

    "errors": {

        "error": [

            {

                "error-message": "invalid value for: ned-id in /ncs:devices/ncs:device[ncs:name='s3cw-e-700']/ncs:device-type/ncs:cli/ncs:ned-id: \"cisco-ios-xr\" is not a valid value.",

                "error-urlpath": "/api/running/devices",

                "error-tag": "malformed-message"

            }

        ]

    }

}

1 Accepted Solution

Accepted Solutions

Raja.Selvaraj
Level 4
Level 4

I tried with below that was working ..

{

  "device": [

    {

      "name": "s3cw-e-700",

      "address": "127.0.0.1",

      "port": 22,

      "authgroup": "default",

      "device-type": {

        "cli": {

          "ned-id": "tailf-ned-cisco-ios-id:cisco-ios-xr",

          "protocol": "ssh"

        }

      }

    }

  ]

}

I have Another question linked to it , why do I always need to give JSON payload with device as a starting-point , why it is not working with below API,

POST -> http://10.xxx.xx.xxx:8080/api/running/devices/device


Body

[

    {

      "name": "s3cw-e-700",

      "address": "127.0.0.1",

      "port": 22,

      "authgroup": "default",

      "device-type": {

        "cli": {

          "ned-id": "tailf-ned-cisco-ios-id:cisco-ios",

          "protocol": "ssh"

        }

      }

    }

  ]

Error:

{

    "errors": {

        "error": [

            {

                "error-message": "POST on list must be on list element",

                "error-urlpath": "/api/running/devices/device",

                "error-tag": "malformed-message"

            }

        ]

    }

}

View solution in original post

1 Reply 1

Raja.Selvaraj
Level 4
Level 4

I tried with below that was working ..

{

  "device": [

    {

      "name": "s3cw-e-700",

      "address": "127.0.0.1",

      "port": 22,

      "authgroup": "default",

      "device-type": {

        "cli": {

          "ned-id": "tailf-ned-cisco-ios-id:cisco-ios-xr",

          "protocol": "ssh"

        }

      }

    }

  ]

}

I have Another question linked to it , why do I always need to give JSON payload with device as a starting-point , why it is not working with below API,

POST -> http://10.xxx.xx.xxx:8080/api/running/devices/device


Body

[

    {

      "name": "s3cw-e-700",

      "address": "127.0.0.1",

      "port": 22,

      "authgroup": "default",

      "device-type": {

        "cli": {

          "ned-id": "tailf-ned-cisco-ios-id:cisco-ios",

          "protocol": "ssh"

        }

      }

    }

  ]

Error:

{

    "errors": {

        "error": [

            {

                "error-message": "POST on list must be on list element",

                "error-urlpath": "/api/running/devices/device",

                "error-tag": "malformed-message"

            }

        ]

    }

}