-
-
Notifications
You must be signed in to change notification settings - Fork 39
Add method to get JSON responses #129
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Great job, no security vulnerabilities found in this Pull Request |
@daivdwe can you tell us which API end points dont work if JSON is selected? And more details on how to reproduce the problems if they dont happen in all cases. |
alert/view/alertCountsByRisk works as HTML but does bomb as XML. (Note it's actually String, Boolean not String, String) |
Raise an issue? Could be a goodfirstissue ? |
Hi @psiinon, yes - @kingthorin described it correctly. I would still love to have my changes as a feature in an upcoming release as it is currently not possible to call the JSON API with the Java Client API. |
Hi @kingthorin, no it is String, String: public ApiResponse alertCountsByRisk(String url, String recurse) throws ClientApiException { |
Sorry I was thinking of what the web API expects or tries to parse. |
I added the DCO flagged missing sign off. |
subprojects/zap-clientapi/src/main/java/org/zaproxy/clientapi/core/ClientApi.java
Outdated
Show resolved
Hide resolved
The changelog should be updated. |
Add support for JSON API calls with new method callApiJSON. Backgound: There are some API methods (e.g. alert/view/alertCountsByRisk) which only work with JSON as the requested response format. Not using JSON (this is a different bug) will result in an "Internal Error" (e.g. Alert#alertCountsByRisk(String, String)). The new method callApiJSON allows java client API users to request a JSON response. We now also can create/build JSON models (e.g. with/for GSON) further enhancing the APIs usability. Signed-off-by: daivdwe <[email protected]>
Improved usability of new callApiJSON method by defaulting to HttpRequest.GET_METHOD Signed-off-by: daivdwe <[email protected]>
Changed name from callApiJSON to callApiJson and return type from byte[] to String. Signed-off-by: daivdwe <[email protected]>
Hi @thc202, I changed the name from callApiJSON to callApiJson and return type from byte[] to String. |
Hi together, when can i roughly expect to find my changes in a release? |
There's still this pending #129 (comment) |
Unreleased: Add support for JSON API calls with new method callApiJson Signed-off-by: daivdwe <[email protected]>
Hi @thc202, sorry - I missed that this was an assignment for me. |
Signed-off-by: thc202 <[email protected]>
Thank you! |
This is released in version 1.16.0. |
Add support for JSON API calls with new method callApiJson.
Background:
There are some API methods (e.g. alert/view/alertCountsByRisk) which only work with JSON as the requested response format. Not using JSON (this is a different bug) will result in an "Internal Error" (e.g. Alert#alertCountsByRisk(String, String)).
The new method callApiJson allows java client API users to request a JSON response. We now also can create/build JSON models (e.g. with/for GSON) further enhancing the APIs usability.