I've installed the Swagger Importer, which is just great. It saved a lot of setup time. It also enumerated all of our APIs optional parameters, which is also good because I don't have to reference docs; however, I don't want GET and POST requests to send the params when I haven't explicitly set the values. Is there a way to configure PAW to not send URL Params when they have no value? One option is to just duplicate an item and then prune the list, but it seems reasonable that there should be a way to simply ignore items that aren't set.
For example:
Don't GET:
http://domain.com/api/v1/users?maxResultCount=&isActive=true
(because maxResultCount is optional and not set)
Instead, do GET:
http://domain.com/api/v1/users?isActive=true
The current release, Paw Version 3.0.7 (Retail) now provides checkboxes on URL parameters.
Related
I need to set my HTSQL server to act as a JSON API server, returning JSON-formatted output by default, not only when a query is followed by /:json. Is there a way to do this?
Reason: I need to send queries that are formulated by software that automatically places parameters (?foo='bar'&baz='moo') at the end of the URL, but HTSQL only recognizes an output format specifier like /:json when it comes at the absolute end of the URL, after the parameters. I don't know a way to build URLs like that without tedious and error-prone direct manipulation of the entire URL.
In other words, HTSQL demands that URLS look like
/mytable?col1='val1'&col2='val2'/:json
but I can't put the /:json after the parameters, so I'm looking for a way to have /:json be automatically implied.
The easiest way to do this is to submit the desired format with the Accept HTTP header. For example, Accept: x-htsql/json should give you JSON output.
You can also change the default output format, but it's rather tedious: You need to create an HTSQL addon and override htsql.core.fmt.emit.EmitDefault extension. Perhaps, you can bypass creating an addon by hot-patching this class.
I have one Parameter on my report, that has multi value on.
And it's values came from a Dataset.
On my application, when I request a report, this parameter goes as an Querystring value. But when I use the multi value option, the parameter is not a single value anymore, but an "array" with multiple values (Of Couse).
REPORT?codArea=&codDiretoria=17&ultimaAlteracao=on&formato=PDF&codListaPrioridade=8&codListaPrioridade=13
Important Part:
(codListaPrioridade=8&codListaPrioridade = 13)
The issue, is the "Available Values" option. The Parameter having an Array as a value, don't have any of the "Available Values" and SSRS throw a error.
Important Part:
System.ServiceModel.FaultException: This report requires a default or user-defined value for the report parameter 'codListaPrioridade'. To run or subscribe to this report, you must provide a parameter value.
If i disable the "Available Values" option, i can send this "array" without any issue:
codArea=&codDiretoria=17&ultimaAlteracao=on&codListaPrioridade=9&codListaPrioridade=13&formato=PDF
Important Part:
(codListaPrioridade=9&codListaPrioridade=13)
="----> "& Join(Parameters!codListaPrioridade.Value, ",")
The trick is that I need create in this report, this parameter with "Available Values" enabled, but this parameter need to accept "Any" values (Because the Array that is coming on querystring).
The "Available Values" must be used to show which values are available only (Inside my application).
Inside SSRS, the parameter works fine, the issue only occurs when using this report in my application, sending the parameters values in a querystring.
The key part of the error is "This report requires a default or user defined value for the report parameter."
You don't need a default parameter. It sounds to me like your application is passing an invalid parameter value to the report. The reason it works when you disable the available values is because then it will accept ANY value at all.
Run the query that populates the available values and keep it open.
Set a breakpoint in your ASP.NET code just before it passes the values to the report server. Examine what those values are and make sure it isn't trying to pass anything that ISN'T in the list of available values you got from running the query.
If there is something different then that is the cause of your error. I can't remember off the top of my head if casing matters so you'll want to check that too. And if you check them and everything is fine... check them again. I don't know how many times I've thought there wasn't any data out of place only to suddenly see it later.
An alternate theory would be that you just aren't passing the multi-value parameter to the report server correctly. I've never tried to do it directly in the URL before but on the MSDN page Pass a Report Parameter Within a URL in the "other examples" section it shows passing a multi-value parameter. In their example they seem to append a number to the end of the parameter name for each value. But I'm not sure if that is right either.
https://myserver/Reportserver?/SQL+Server+User+Education+Team/_ContentTeams/folder123/team+project+report&teamgrouping2=xgroup&teamgrouping1=ygroup&OrderID=747&OrderID=787&OrderID=12
But since you're already writing .NET code let me make a suggestion. Use the webservice as a webservice. It makes things like this so much easier. You just add the web service as a reference to the project and then basically call it like any other .NET class. The reference reads the WSDL file and shows you all of the available API calls and their parameters and what you'll get back. It really is quite a nice feature. Check out this MSDN article on "How to: Add a Reference to a Web Service" and then this TechNet dev guide: https://technet.microsoft.com/en-us/library/bb522713.aspx
I'm trying to filter on AppDynamics to get all the request to a particular REST URL, the REST URL is not fixed as long as in the URL
/AppEngine/rest/evac/${id}/createNewActivity
On the Transaction Snapshots you have the option to filter results, and in the filters you can filter by URL:
If I search for a concrete URL (with ${id} defined) I can search it, but I cannot find how to use a wildcar to find this URL with any ${id}. I tried so far to use
/AppEngine/rest/evac/*/createNewActivity
/AppEngine/rest/evac/.*/createNewActivity
With no results.
The one with works just a bit is using /AppEngine/rest/evac/* which also retrieves other REST which start with the same URL, so I can export the results and filter outside AppDynamics.
But there is a way to use a wildcard so I can find the desired results in AppDynamics?
Even it is not the desired behaviour, if filtering by URL and specifying only createNewActivity worked for me (as long as there are no other REST URLs matching this).
I did create a simple testcase in JMeter.
Open a form and all it's content (css, images etc) :
GET /
GET /css/site.css
GET /favicon.ico
GET /fonts/specific-fonts.woff
GET /images/banner.png
Wait a little...
Post the values
POST /
Receive the "Thank You" page.
- GET /thanks
In the response on the first GET is a hidden input field which contains a token. This token needs to be included in the POST as well.
Now I use the "Regular Expression Extractor" of JMeter to get the token from the response. So far, so good.
Then, after retreiving all the other contents I create the POST message, using the variable name in the RegExp-Extractor in the value field of the token parameter.
But... when executing the testcase it fills in the default value given and not the actual value of the token.
So... first step in debugging this issue was to add a dummy-HTTP-GET request directly after I get the token. In this GET request I also add the token parameter with the token variable as value, but now I can easily check the parameter by looking at the access-log on my webserver.
In this case... the URL looks promising. It contains the actual token value in the GET, but it still uses the default value in the POST.
Second step in debugging was to use the "Debug Sampler" and the "View Results Tree".
By moving the Debug Sampler between the different steps I found out the value of the token-variable is back to the default value after I receive the CSS.
So... now the big question is...
How can I make JMeter to remember my variable value until the end of my test-script ?
JMeter doesn't "forget" variables. However variables scope is limited to the current Thread Group. You can convert JMeter variable to JMeter Property which have "global" scope by i.e. using Beanshell Post Processor with the following code:
props.put("myVar", vars.get("myVar"));
Or by using __setProperty() function. See How to Use Variables in Different Thread Groups guide for details.
As you found it your problem comes from a misunderstanding of scoping rules in jmeter.
https://jmeter.apache.org/usermanual/test_plan.html#scoping_rules
In your case, just put the post processor of the request that will give you the response containing the child node.
Also I think you don't need to share this token with other threads so don't use properties as proposed in the alternate answer.
I have a Java component which scans through a set of folders (input/processing/output) and returns the list of files in JSON format.
The REST URL for the same is:
GET http://<baseurl>/files/<foldername>
Now, I need to perform certain actions on each of the files, like validate, process, delete, etc. I'm not sure of the best way to design the REST URLs for these actions.
Since its a direct file manipulation, I don't have any unique identifier for the files, except their paths. So I'm not sure if the following is a good URL:
POST http://<baseurl>/file/validate?path=<filepath>
Edit: I would have ideally liked to use something like /file/fileId/validate. But the only unique id for files is its path, and I don't think I can use that as part of the URL itself.
And finally, I'm not sure which HTTP verb to use for such custom actions like validate.
Thanks in advance!
Regards,
Anand
When you implement a route like http:///file/validate?path you encode the action in your resource that's not a desired effect when modelling a resource service.
You could do the following for read operations
GET http://api.example.com/files will return all files as URL reference such as
http://api.example.com/files/path/to/first
http://api.example.com/files/path/to/second
...
GET http://api.example.com/files/path/to/first will return validation results for the file (I'm using JSON for readability)
{
name : first,
valid : true
}
That was the simple read only part. Now to the write operations:
DELETE http://api.example.com/files/path/to/first will of course delete the file
Modelling the file processing is the hard part. But you could model that as top level resource. So that:
POST http://api.example.com/FileOperation?operation=somethingweird will create a virtual file processing resource and execute the operation given by the URL parameter 'operation'. Modelling these file operations as resources gives you the possibility to perform the operations asynchronous and return a result that gives additional information about the process of the operation and so on.
You can take a look at Amazon S3 REST API for additional examples and inspiration on how to model resources. I can highly recommend to read RESTful Web Services
Now, I need to perform certain actions on each of the files, like validate, process, delete, etc. I'm not sure of the best way to design the REST URLs for these actions. Since its a direct file manipulation, I don't have any unique identified for the files, except their paths. So I'm not sure if the following is a good URL: POST http:///file/validate?path=
It's not. /file/validate doesn't describe a resource, it describes an action. That means it is functional, not RESTful.
Edit: I would have ideally liked to use something like /file/fileId/validate. But the only unique id for files is its path, and I don't think I can use that as part of the URL itself.
Oh yes you can! And you should do exactly that. Except for that final validate part; that is not a resource in any way, and so should not be part of the path. Instead, clients should POST a message to the file resource asking it to validate itself. Luckily, POST allows you to send a message to the file as well as receive one back; it's ideal for this sort of thing (unless there's an existing verb to use instead, whether in standard HTTP or one of the extensions such as WebDAV).
And finally, I'm not sure which HTTP verb to use for such custom actions like validate.
POST, with the action to perform determined by the content of the message that was POSTed to the resource. Custom “do something non-standard” actions are always mapped to POST when they can't be mapped to GET, PUT or DELETE. (Alas, a clever POST is not hugely discoverable and so causes problems for the HATEOAS principle, but that's still better than violating basic REST principles.)
REST requires a uniform interface, which in HTTP means limiting yourself to GET, PUT, POST, DELETE, HEAD, etc.
One way you can check on each file's validity in a RESTful way is to think of the validity check not as an action to perform on the file, but as a resource in its own right:
GET /file/{file-id}/validity
This could return a simple True/False, or perhaps a list of the specific constraint violations. The file-id could be a file name, an integer file number, a URL-encoded path, or perhaps an unencoded path like:
GET /file/bob/dir1/dir2/somefile/validity
Another approach would be to ask for a list of the invalid files:
GET /file/invalid
And still another would be to prevent invalid files from being added to your service in the first place, ie, when your service processes a PUT request with bad data:
PUT /file/{file-id}
it rejects it with an HTTP 400 (Bad Request). The body of the 400 response could contain information on the specific error.
Update: To delete a file you would of course use the standard HTTP REST verb:
DELETE /file/{file-id}
To 'process' a file, does this create a new file (resource) from one that was uploaded? For example Flickr creates several different image files from each one you upload, each with a different size. In this case you could PUT an input file and then trigger the processing by GET-ing the corresponding output file:
PUT /file/input/{file-id}
GET /file/output/{file-id}
If the processing isn't near-instantaneous, you could generate the output files asynchronously: every time a new input file is PUT into the web service, the web service starts up an asynchronous activity that eventually results in the output file being created.