Stackdriver filter url contains - trace

I using stackdriver i have massive requests on resource. I need filter request for sub resource.
Example url:
/api/1/resource/{id}/subresource
How to filter only request for /subresource ?
This is possible using web version of trace?

A possible solution (not the easiest) would be to install the Fluentd.org plugin and use wildcard as it is explain in this link
path /api/1/resource/*

Related

Sails can I use Actions2 for GET request

The issue
Can I use actions2 for GET requests with query params?
Example
https://path/filename?id=123&age=45
If this is the url in request, can I access each param as input.id and input.age?
I have not found many resources (basically only one) that show examples of this syntax being used for requests with query string parameters.
The github page redirects to a blog where they talk about the different methods one can apply actions2 syntax to, but does not directly display an example with a GET request
https://www.logisticinfotech.com/2018/sails-js-actions2-example-with-crud/.
The only online source that somewhat confirms this affirmation is the following:
how to get query parameter in action2 in sails.
I am a newbie in SailsJS so feel free to ask me additional information.
Yes, you can use Actions2 for any API request; PUT, POST, GET, etc.
Here is an example from a repo I open sourced: https://github.com/neonexus/sails-react-bootstrap-webpack/blob/release/api/controllers/admin/get-me.js
While the example isn’t using GET params, it would use the “inputs” section just like with a PUT.

Using JSON Search Queries with a GET request in JMeter

My org is trying to use JMeter as part of a test automation suite to test some back end REST APIs. Currently one of them supports using JSON queries as a way to get filtered results back from a GET request.
We are using the JMeter UI to create these tests and since all the other API calls work under the HttpClient3.1 HTTP Request implementation that is the implementation that I am currently using to get this to work. With this implementation I get the following when looking at the failure in the results tree (response data portion) I have made the error slightly more generic to protect some IP:
java.lang.IllegalArgumentException: Invalid uri 'https://server:port/restservice/v1/users?firstname_query={"in":["User1FirstName","User2FirstName"]}': Invalid query
at org.apache.commons.httpclient.HttpMethodBase.(HttpMethodBase.java:222)
at org.apache.commons.httpclient.methods.GetMethod.(GetMethod.java:89)
at org.apache.jmeter.protocol.http.sampler.HTTPHC3Impl.sample(HTTPHC3Impl.java:229)
at org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy.sample(HTTPSamplerProxy.java:74)
at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1146)
at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1135)
at org.apache.jmeter.threads.JMeterThread.process_sampler(JMeterThread.java:434)
at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:261)
at java.lang.Thread.run(Unknown Source)
I have also tried the same request using the Java implementation and get a similar result.
If anyone has any ideas or if you need more information let me know and thank you again in advance for any help you may be able to provide.
Your HTTP Request configuration is a little bit incorrect. JSON entities contain braces {} which are not allowed in URLs so you need to encode them.
Configure your HTTP Request sampler like:
Make sure "Encode" box is ticked.
And this way you will be able to send JSON with HTTP GET Requests. You can use View Results Tree listener to inspect request and response details:
You might also need to add HTTP Header Manager to your Test Plan and configure it to send Content-Type header with the value of application/json. See Testing SOAP/REST Web Services Using JMeter article for more details on properly configuring JMeter for testing REST APIs.

What's the correct uri for QBO v3 API update operation?

I'm trying to use the QBO v3 API object update function described here. The API explorer shows a different uri.
I'm trying to update an account with Id 42. Both of the following URIs get me a 401:
As the documentation would suggest:
https://quickbooks.api.intuit.com/v3/company/0123456789/account?requestid=42
(the above at least gives me a json blob with the 401)
As the api explorer would suggest:
https://qb.sbfinance.intuit.com/v3/company/0123456789/account?operation=update
(here I don't even get the json, just a plain 401)
My request body is successful when I use the api explorer, so I don't believe that's the problem. I also don't believe authentication is the problem, because I can successfully create objects and also make queries with the same headers.
What might I be missing?
Don't put the Account object's ID into the URL. The [?requestid=] from the documentation you mentioned apparently refers to an id related to the request (not the object in question). The API Explorer's URI appears to simply mislead (although I could certainly be missing something here).
In your example, just use this:
https://quickbooks.api.intuit.com/v3/company/0123456789/account
Let the headers and request body do the rest.
Correct BASE URI: https://quickbooks.api.intuit.com/v3/company/
you can refer example request/response section of any entity doc.
Ref -https://developer.intuit.com/docs/0025_quickbooksapi/0050_data_services/030_entity_services_reference/bill
To debug(401 authentication issue), you can use any standard RestClient.
In the following thread, I've explained how to use RestClinet plugin of Mozilla to test any QBO V3 endpoint.
InvalidTokenException: Unauthorized-401
You can download IPP's devkit and using that devkit you can call any endpoints easily.
https://developer.intuit.com/docs/0025_quickbooksapi/0055_devkits
Hope it will be useful.
Thanks

wso2 api manager 1.6.0 query parameters not accepted

I am using wso2 API manager 1.6.0 and would like to create an API which accepts any POST
on /users resource followed by any query parameter such as "clientid" (as described below)
restserver.com:8280/context/1/users?clientid=333
I have created an API in API publisher as follow :
URL Prefix URL Pattern HTTP Verb
/context/1 /users/* POST
Any POST on /users is accepted but as sson as I add a query paramter /users?clientid=333 , the request is rejected by the API Manager gateway with 403 error.
Could someone advice me on this and what should be the correct url-mapping format ?
The resulting url-mapping in synapse config file is as follow : (synapse-configs/default/api/)
Thanks a lot.
JS
For this you need to define uri-template instead of uri-mapping. This blog post explains more about this.
For your case I got it working as following.
Open your API configuration source which can be found at AM_HOME\repository\deployment\server\synapse-configs\default\api folder.
In the resource tag change url-mapping="/users/*" attribute to uri-template="/users/*"
But you will have to invoke the API as follows with additional context because when you say /users/* it means anything can come after users/. So you need to have a / after users context.
restserver.com:8280/context/1/users/usr?clientid=333

Grails - integration tests for verifying REST calls

We'd like to add some integration tests for the many REST services that our Grails app exposes, instead of manually verifying them using the Firefox Poster plugin that we are currently using.
BTW, In our case it HAS to be an integration test, not a unit test.
I trust others have gone thru' this before and could save us some time instead of experimenting...
`grails test-app -integration`
Does the above command actually launch the functionality required to do a self-post to our own app (http://localhost/myapp) ? It would have to go through the url mapping pipeline, xml content negotiation, spring/acegi security, etc. If so, I suppose we could use the Groovy RESTClient as documented here:
http://groovy.codehaus.org/modules/http-builder/doc/rest.html
Google tells me another option is the functional-testing plugin:
http://thediscoblog.com/2009/06/15/grails-hip-tip-testing-restful-services/
Any comments or issues from the experienced? It's a Grails 1.2.1 app using plugins.acegi=0.5.2
What you want is
grails test-app integration:
As per http://grails.org/doc/latest/ref/Command%20Line/test-app.html
The REST services are usually created via actions in a controller that are set in the URLMappings to work with the different HTTP methods (GET, PUT, POST, DELETE), so since they are simple actions in a controller an integration test can be just a test method that test the action like any other, sending them the content-type you need, JSON for example and passing the correct data as JSON if that is what your services is expecting.
You can create multiple test methods for the same action to test the difference responses, for example if a non valid resource is requested than test that the service is returning the correct error code 404 for instance.