Ignition Webdev Get API

Hello team,
Im trying to build API by webdev module. Im getting error


I have attached simple system library function for AP which call named query & revert back result by API
API request:

ParamId=1

URL="http://10.30.80.6:8088/system/webdev/Reports/GetEntityLevel"
params={"params": ParamId} 
client = system.net.httpClient()
data='application/json'
print params
response = client.get(URL,data,params)
print response
print response.getStatusCode()
print response.getText()  

API code

API response

{'params': 1}
<Response@883603983 'http://10.30.80.6:8088/system/webdev/Reports/GetEntityLevel?application/json' [500]>
500
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1"/>
<title>Error 500 Server Error</title>
</head>
<body><h2>HTTP ERROR 500 Server Error</h2>
<table>
<tr><th>URI:</th><td>/system/webdev/Reports/GetEntityLevel</td></tr>
<tr><th>STATUS:</th><td>500</td></tr>
<tr><th>MESSAGE:</th><td>Server Error</td></tr>
</table>

</body>
</html>

Please help with below error

The first line of the stacktrace tells you exactly what's wrong: KeyError.
try request['data']['params']

1 Like

Hello @pascal.fragnoud

Thanks for support..
Now after changing im getting error

Please help to resolve issue

You'll have to show some code if you want help fixing code...
The only thing we can say from this: you're trying to subscript a string like a dict:
"some_string"['key'] instead of "some_string[indice]"

Hello @pascal.fragnoud
Thanks its working for me