Hi I have a collection in Postman which will not work unless i have a token and in order to
generate this token i have to add the following details per the image.
I want to add these same parameters within Jmeter so that my APIs will work... This is Auth 2.0 how can i add all those values within Jmeter...?
There is no single place where you can put these parameters in JMeter because OAuth 2.0 is a series of requests/responses so you need to implement all these requests which Postman makes under the hood with JMeter's HTTP Request samplers and perform the correlation of the dynamic parameters.
The requests can be even recorded using JMeter's HTTP(S) Test Script Recorder if you configure Postman to use JMeter as the proxy
Related
I generate an API and Collection for my app by applying the steps on the following article: The hidden gem: Postman API and Documentation feature.
You may try by using a test endpoint e.g. https://petstore.swagger.io (user:test, pass:abc123).
Here is an example json body that I am trying to generate:
{
"name": "{{$randomLoremSentence}}",
"description": "{{$randomAdjective}}",
"productUuid": "{{productUuid}}",
"address": "{{$randomLoremSentence}}"
}
However, I am looking for a practical way for generating json body for Postman requests. Is there a proper way for this? Or do ı have to build each request manually? I think there must a a smarter way. Any idea?
The JSON response body is not created within POSTMAN, it is generated by the response from a web API HTTP request.
The API method that is executed determines the response.
Once you have determined the response and it's structure, you can then create the request and test script within a POSTMAN Collection.
It is easier to manually test each HTTP request with sample inputs then copy that into an existing Collection, then write the test scripts for each test case, template any input parameters into URL query strings or the
JSON request body with global or collection scoped variables.
After you have determined how to parameterize and template each request (and both the Test Script and Pre-request Script), you will then be able to
implement the test script to create assertions on the JSON response content using BDD expressions.
I recommend looking at the POSTMAN documentation at
https://learning.postman.com/docs/writing-scripts/test-scripts/
https://learning.postman.com/docs/writing-scripts/script-references/test-examples/
as it shows some really good examples on how to create a basic test, then automate it using JavaScript, Chai BDD language and the POSTMAN Collection Runner.
This is based on my experience with POSTMAN. I am not aware of any simple way
to automate request and test script creation from API Swagger definitions as every API method response could have any number of potential responses based on different inputs, so this (I believe) has to be constructed manually by the tester.
I am trying to build a Custom Connector in the Power Platform to connect to the BMC Helix (formerly Remedy) system to create work orders and such. I am using OAuth2 and was given a callback URL, auth URL, token URL, client ID and client secret.
I went to create a connector from scratch. I populated the fields, but I wasn't sure what to put for the 'Refresh URL', so I used the token URL there too.
I am trying to accomplish testing this connector and my successful test would be to get a JWT from doing a POST to the /api/jwt/login endpoint of BMC Helix. It should return a JWT which I can use to make subsequent calls.
Upon testing this, I go to create a connection, but a window opens (which I believe should be a prompt for authentication), but instead it contains an error saying 'unauthorized_client' coming back from the BMC Helix system at the /rsso/oauth2/authorize endpoint. It also contains a property within the URL of redirect_uri = https://global.consent.azure-apim.net/redirect.
Is there something on the Helix side I need to further configure? Not sure why I am getting this....
It sounds like you need TWO METHODS in your connector. A POST to call the token server, a GET (or another POST) to call the API (using the token received from Call 1).
One approach I've successfully used in the past is:
Use Postman to get your token server call working with OAUTH
Then use Postman to get your subsequent API calls working with the token appended
Save both requests to a single Postman collection
Export the Postman collection (as a V1 (deprecated) if I recall correctly)
Import this collection into PowerApps Custom Connector (create new/import from Postman Collection)
You'll have to massage it a bit after import, but it will give you a good headstart and you're starting from a known-good place (working Postman calls)
Good luck!
We have implemented an OAuth2 Authorization Server (and Identity Provider).
Now we want to perform load tests to gage system performance.
The concrete problem I have now, is that I want to load test an Authorization Code Flow.
I have been using JMeter so far. But I have no clue how to provide an endpoint for the required redirect_uri, to complete the flow.
Is there any way to do this at all, or am I out of luck? Google was no help.
If JMeter can't do it, is there a tool that can?
Provide whatever redirect_uri parameter you want, i.e. http://localhost:8081/oauth/login and fetch the required parameters from the response Location header using Regular Expression Extractor
Of course the sampler will fail as most probably you don't have anything running on your machine which could serve as a redirect target so either use HTTP Mirror Server to provide a stub or just mark the sampler as successful by adding Response Assertion to it and ticking Main sample and sub-samples and Ignore Status boxes
What is the purpose of "API token" option in REST API Call Plugin Configuration? Why it is compulsory?
On screenshots below it was set to "rest" but never used afterwards. Any examples?
https://thingsboard.io/docs/reference/plugins/rest/
The purpose of the API token is to reserve certain path in the REST and Websocket API to particular plugin.
So, all requests that match certain URL filter:
http(s)://host:port/api/plugins/$API_TOKEN/
Will be dispatched to the plugin implementation after security check.
Plugin can apply additional checks if required.
Trying to automate my test cases using jmeter. I have used cxf for rest apis on my web server. I have an api which actually takes a java object as parameter. On jmeter I have selected the POST method under HTTP-request and sending json data in Body data. The api gets called fine. However the parameter comes null and hence by api fails. I did try changing the parameter to String object, however I get this string as null.
Is this the right way to call apis via jmeter. Or is this failing because I have used cxf on my server.
Any help is appreciated.
Thanks
Most likely you need to add a HTTP Header Manager and configure it to send Content-Type header with the value of application/json
See Testing SOAP/REST Web Services Using JMeter for detailed explanation on JMeter configuration for REST API testing.
Other thing you could try out is using SoapUI tool to send the request to your CXF endpoint and if it succeeds - inspect the request and configure JMeter accordingly. By the way, SoapUI has some limited load testing capabilities, may be it will be enough for your scenario