Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Step

Screenshot

About Adding JSON Return Values

When we simply added some values into the JSON, we could have added any sort of content that you want to include. In the previous case, we added these:

"header_count": len(response.headers),

"content_size": len(response.content)

 

Adding More Values

A very powerful concept that Apica supports with Scripted Checks: Add more fields to add more values.

Let’s capture the headers coming out of our response by creating another field and calling it 'headers.' This is going to be an actual inner JSON object that contains our headers.

Add dict_response.headers and rerun the check. The result shows that we have our header, JSON, inside this field.

Anything that JSON supports is supported in this result format. So you can add lists, inner dictionaries, null values, integers, booleans, etc. to this JSON.

Later, we will show you how to retrieve this information through the ASM API. So anything that you can get from your code, you can get through the ASM API as your check is runTest your check locally before uploading to a repository which is linked to ASM. If you have a private agent with the necessary software installed and are planning to run the script on that agent, it is possible to test the script locally on the agent before uploading to your repository. See https://apica-kb.atlassian.net/wiki/spaces/ASMDOCS/pages/2135393547/Scripted+Check#Testing-a-Script-on-the-Executing-Agent-Itself for more information.

2. Uploading the Check to a Repository

...

 Testing a Script on the Executing Agent Itself

If you are running a script from a private agent, It is possible to run a scripted check locally on the agent itself it locally in order to ensure that all packages are installed in the correct location and that there are no syntax errors, etc. are present. It is an excellent step to use when troubleshooting Python checks which are not running correctly.

...