TimJordan Posted May 9 Share Posted May 9 Hello I have a powershell script which I have developed to update a data set in the netscaler. This has been working fine for a month or so and now all of a sudden everytime we do any write command to the API we receive a 1600 error. Nothing has changed code wise and we can still read from the api fine. Any ideas? 1 Link to comment Share on other sites More sharing options...
Rick Davis Posted May 9 Share Posted May 9 Can you post your code or the API call you are sending and the code version you are using? You can find a description for all error codes under the API Specification here: https://developer-docs.netscaler.com/en-us/nextgen-api/apis/#/Authentication/Login 1 Link to comment Share on other sites More sharing options...
TimJordan Posted May 9 Author Share Posted May 9 $body = @{ value_set = @{ name = $valsetname type = "ipv4" values = $ips } } $jsonBody = convertto-json -InputObject $body $myURI = New-object System.UriBuilder -argumentlist 'https', $activeNetscaler, 443, "/mgmt/api/nextgen/v1/filters/value_sets/$valsetname" $response = Invoke-webrequest -Method "POST" -Uri $myURI.Uri -ContentType 'application/json' -WebSession $saveSession -body $jsonBody -UseBasicParsing This returns Invoke-webrequest : {"errorcode":1600,"errormessage":"Internal Server Error","details":[]} This was working until the middle of last week and now all we seem to get is 1600s if I do $myURI = New-object System.UriBuilder -argumentlist 'https', $activeNetscaler, 443, "/mgmt/api/nextgen/v1/filters/value_sets/$valsetname" $response = Invoke-webrequest -Method "GET" -Uri $myURI.Uri -ContentType 'application/json' -WebSession $saveSession -UseBasicParsing then I can see the contents of the filter in $response.content fine 1 Link to comment Share on other sites More sharing options...
TimJordan Posted May 9 Author Share Posted May 9 Are there any logs from the netscaler I can pull that would help locate what the issue is? 1 Link to comment Share on other sites More sharing options...
Rick Davis Posted May 10 Share Posted May 10 I do not see any problems in your PS code. The details in the error message suggest a listing problem in the payload. For example, I can get the same 1600 error when using properly formatted, but an incorrect, json payload list. In this case, sets can be fetched in list [] form but cannot be submitted in list form. For example, this worked: POST /mgmt/api/nextgen/v1/filters/value_sets/val_set { "value_set": { "name": "val_set", "type": "ipv4", "values": [ "192.168.11.11", "192.168.11.12", "192.168.11.13", "192.168.11.14" ] } } But submitting this payload did not work, resulting in the Error: { "errorcode": 1600, "errormessage": "Internal Server Error", "details": [] } Please know, this is the example returned when fetching value sets. { "value_set": [ { "name": "val_set", "type": "ipv4", "values": [ "192.168.11.11", "192.168.11.12", "192.168.11.13", "192.168.11.14" ] } ] } I also get the same error when using "value_sets" in the payload rather than the required "value_set". The more I test, the more I'm coming to the conclusion the 1600 is being returned due to a payload problem. Not a formatting problem, but incorrect labels or values. 1 Link to comment Share on other sites More sharing options...
TimJordan Posted May 10 Author Share Posted May 10 Ok I created a json object using here string $jsonbody = @" { "value_set": { "name": "val_set", "type": "ipv4", "values": [ "192.168.11.11", "192.168.11.12", "192.168.11.13", "192.168.11.14" ] } } "@ and then I tried to post it $myURI = New-object System.UriBuilder -argumentlist 'https', $activeNetscaler, 443, "/mgmt/api/nextgen/v1/filters/value_sets/val_set" $response2 = Invoke-webrequest -Method "POST" -Uri $myURI.Uri -ContentType 'application/json' -WebSession $saveSession -body $jsonBody -UseBasicParsing and I still get the same error from the api Invoke-webrequest : {"errorcode":1600,"errormessage":"Internal Server Error","details":[]} At line:1 char:14 + ... response2 = Invoke-webrequest -Method "POST" -Uri $myURI2.Uri -Conten ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-WebRequest], WebExc eption + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand 1 Link to comment Share on other sites More sharing options...
TimJordan Posted May 10 Author Share Posted May 10 The error we are seeing in the ngapi.log is May 10 15:33:58 <local5.notice> cgcngwp [1094] [ERROR]: trace-id=c337e0f1-159f-41e6-aeeb-7b5b563bf314 process-name=frontend username=xxxxx Table nitro_entities_name_map is not found. nitro_entities_name_map May 10 15:33:58 <local5.notice> cgcngwp [1094] [ERROR]: trace-id=c337e0f1-159f-41e6-aeeb-7b5b563bf314 process-name=frontend username=xxxxx PostgreSQLDBInterface:Error while reading data nitro_entities_name_map {'res_id': 3}. 'NoneType' object has no attribute 'c' May 10 15:33:58 <local5.notice> cgcngwp [1094] [ERROR]: trace-id=c337e0f1-159f-41e6-aeeb-7b5b563bf314 process-name=frontend username=xxxxx Exception occurred in handle_filter_value_set Traceback (most recent call last): File "build/bdist.freebsd-11.4-RELEASE-amd64/egg/ngapi_frontend/common/filter_value_set_utils.py", line 92, in handle_filter_value_set File "build/bdist.freebsd-11.4-RELEASE-amd64/egg/ngapi_lib/utils/sb_graph_component_renaming_handler.py", line 138, in rename File "build/bdist.freebsd-11.4-RELEASE-amd64/egg/ngapi_lib/utils/sb_graph_component_renaming_handler.py", line 64, in __get_entity_name_map_for_resource_id File "build/bdist.freebsd-11.4-RELEASE-amd64/egg/mpspython/infra/store/abstractstore.py", line 38, in get_all File "build/bdist.freebsd-11.4-RELEASE-amd64/egg/mpspython/infra/store/dbstore.py", line 33, in do_get_all File "build/bdist.freebsd-11.4-RELEASE-amd64/egg/mpspython/infra/database/postgressqldbclient.py", line 653, in get File "build/bdist.freebsd-11.4-RELEASE-amd64/egg/mpspython/infra/database/postgressqldbclient.py", line 589, in get File "build/bdist.freebsd-11.4-RELEASE-amd64/egg/mpspython/infra/database/postgressqldbclient.py", line 242, in _UDB_to_filter_data AttributeError: 'NoneType' object has no attribute 'c' May 10 15:33:58 <local5.notice> cgcngwp [1094] [ERROR]: trace-id=c337e0f1-159f-41e6-aeeb-7b5b563bf314 process-name=frontend username=xxxxx {'errorcode': 1600, 'errormessage': 'Internal Server Error', 'details': []} May 10 15:33:58 <local5.notice> cgcngwp [1094] [INFO]: trace-id=c337e0f1-159f-41e6-aeeb-7b5b563bf314 process-name=frontend username=xxxxx 500 INTERNAL SERVER ERROR 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now