05-27-2019 07:20 AM
Hello,
Does anybody know where to find vManage API log ? I try to do some API calls to create a template using API, but unfortunately I got an "internal server error" with an internal code like
{ "error": { "message": "Server error", "details": "Unknown error", "code": "REST0001" } }
Could anyone please help how to get more verbose information ?
Solved! Go to Solution.
05-27-2019 08:17 AM
Hello,
you can look at the /var/log/nms/vmanage-server.log and /var/log/nms/vmanage-server-rest.log.
Use command show log and one of the above path names and you will see the logs printed on screen.
Or go into vsh and look at the files using your favourite linux commands.
REST001 seems to be some uncaught exception. Maybe the above logs show more detail.
Regards,
Danny.
05-28-2019 08:46 AM
Hello,
the closest example I could get for the json body is in jinja format used in Python.
One needs other calls to get all the feature template IDs so it it not that straightforward.
There are some good API examples on devnet.
https://developer.cisco.com/learning/modules/cisco_sd-wan_with_ansible
Regards,
Danny.
{ "templateName": "{{item.keys()[0]}}", "templateDescription": "{{ item.values()[0].Template_Description }}", "deviceType": "{{ Type }}", "configType": "template", "factoryDefault": false, "policyId": "", "featureTemplateUidRange": [], "connectionPreferenceRequired": true, "connectionPreference": true, "generalTemplates": [ { "templateId": "{{feature_template_db[item.values()[0].Feature_AAA]}}", "templateType": "aaa" }, { "templateId": "{{feature_template_db[item.values()[0].Feature_BFD]}}", "templateType": "bfd-vedge" }, { "templateId": "{{feature_template_db[item.values()[0].Feature_OMP]}}", "templateType": "omp-vedge" }, { "templateId": "{{feature_template_db[item.values()[0].Feature_Security]}}", "templateType": "security-vedge" }, { "templateId": "{{feature_template_db[item.values()[0].Feature_System]}}", "templateType": "system-vedge", "subTemplates": [ { "templateId": "{{feature_template_db[item.values()[0].Feature_Logging]}}", "templateType": "logging" } ] }, {% for vpn in item.values()[0].Feature_VPN %} { "templateId": "{{feature_template_db[vpn]}}", "templateType": "vpn-vedge", "subTemplates": [ {% for subtemplate in item.values()[0].Feature_VPN[vpn] %} { "templateId": "{{feature_template_db[subtemplate]}}", "templateType": "vpn-vedge-interface" }, {% endfor %} ] }, {% endfor %} { "templateId": "{{feature_template_db[item.values()[0].Feature_Banner]}}", "templateType": "banner" }, { "templateId": "{{feature_template_db[item.values()[0].Feature_SNMP]}}", "templateType": "snmp" } ] }
05-27-2019 08:17 AM
Hello,
you can look at the /var/log/nms/vmanage-server.log and /var/log/nms/vmanage-server-rest.log.
Use command show log and one of the above path names and you will see the logs printed on screen.
Or go into vsh and look at the files using your favourite linux commands.
REST001 seems to be some uncaught exception. Maybe the above logs show more detail.
Regards,
Danny.
05-28-2019 02:00 AM
@Danny De Ridder wrote:Hello,
you can look at the /var/log/nms/vmanage-server.log and /var/log/nms/vmanage-server-rest.log.
Use command show log and one of the above path names and you will see the logs printed on screen.
Or go into vsh and look at the files using your favourite linux commands.
REST001 seems to be some uncaught exception. Maybe the above logs show more detail.
Regards,
Danny.
Thank you for the information Danny. I did get some logs of the API, especially on /var/log/nms/vmanage-server.log where there is a java error stack displayed. However the error is java.lang.NullPointerException, which doesn't tell what did I do wrong. You can find the screenshot attached.
I tried to create a device template by posting on this API endpoint (/template/device/feature) with the following data :
{ "templateName":"testAPI_DeviceTemplate", "configType":"template", "deviceType" : "vedge-cloud", "templateDescription" : "testAPI_DeviceTemplate", "requiredTemplate" : [ "Factory_Default_vSmart_vManage_Security_Template" ] } |
I couldn't find any way to know what is the correct json object to put to the request body. Would there be some hints please?
Fyi. I tried to surf the documentation but nothing explained on how to create a device template via API.
Thank you for any help.
Regards,
Rahenda
05-28-2019 08:46 AM
Hello,
the closest example I could get for the json body is in jinja format used in Python.
One needs other calls to get all the feature template IDs so it it not that straightforward.
There are some good API examples on devnet.
https://developer.cisco.com/learning/modules/cisco_sd-wan_with_ansible
Regards,
Danny.
{ "templateName": "{{item.keys()[0]}}", "templateDescription": "{{ item.values()[0].Template_Description }}", "deviceType": "{{ Type }}", "configType": "template", "factoryDefault": false, "policyId": "", "featureTemplateUidRange": [], "connectionPreferenceRequired": true, "connectionPreference": true, "generalTemplates": [ { "templateId": "{{feature_template_db[item.values()[0].Feature_AAA]}}", "templateType": "aaa" }, { "templateId": "{{feature_template_db[item.values()[0].Feature_BFD]}}", "templateType": "bfd-vedge" }, { "templateId": "{{feature_template_db[item.values()[0].Feature_OMP]}}", "templateType": "omp-vedge" }, { "templateId": "{{feature_template_db[item.values()[0].Feature_Security]}}", "templateType": "security-vedge" }, { "templateId": "{{feature_template_db[item.values()[0].Feature_System]}}", "templateType": "system-vedge", "subTemplates": [ { "templateId": "{{feature_template_db[item.values()[0].Feature_Logging]}}", "templateType": "logging" } ] }, {% for vpn in item.values()[0].Feature_VPN %} { "templateId": "{{feature_template_db[vpn]}}", "templateType": "vpn-vedge", "subTemplates": [ {% for subtemplate in item.values()[0].Feature_VPN[vpn] %} { "templateId": "{{feature_template_db[subtemplate]}}", "templateType": "vpn-vedge-interface" }, {% endfor %} ] }, {% endfor %} { "templateId": "{{feature_template_db[item.values()[0].Feature_Banner]}}", "templateType": "banner" }, { "templateId": "{{feature_template_db[item.values()[0].Feature_SNMP]}}", "templateType": "snmp" } ] }
05-31-2019 01:53 AM
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide