How to use Postman and the FIWARE API? - fiware

Some of the tutorials of the FIWARE Wednesday Webinars e.g. this one https://youtu.be/SP0zFdTybA4, show the use of Postman to interact with the FIWARE API. I am not sure what configuration needed to get it up and running.
I could use the curl command but when run the postman. I am new to both FIWARE API and Postman.
Can anyone show me how to configure Postman to use with FIWARE API? Thanks.

Install Postman
Check out one of the Tutorials
At the top of the Tutorial, there is the option "Run in Postman"
Postman will open and you will see the collection e.g. "FIWARE Getting started"
If you Fiware system runs at a different server than localhost, e.g. example.com you need to modify the variable {{orion}} in the collection
Click on the three dots at the collection, then choose Edit and in the Variables tab overwrite Current value with your server address.

Install and launch Postman.
Change the request operation as required(POST, GET, APPEND, etc).
Enter the public IP Address of required node, with full path.
For example:
In case of POST request to iotagent-json: http://<Ip Address>:7896/iot/json?i=<deviceID>&k=<api-key>
In case of GET request from Orion context-broker: http://<Ip Address>:1026/v2/entities
Add headers(-H) in Headers tab:
Add fiware-service, fiware-servicepath, content-type and its values.
Default value of fiware-service is openiot and fiware-servicepath is /.
If request type is POST, add data payload in Body tab, also choose aplication/json as content type from the dropdown menu.
Send to hit the given API.
One can also import CURL request statement in Postman:
Open Postman Application
Click Import, located on top-left corner
From Import, select tab “Paste Raw Text”
Copy and paste the CURL request data to the given input area below “Paste Raw Text” tab.
Click Import located at the bottom-right
Check whether data type is application/json or not in body tab, if not select
application/json from the drop-down menu in body tab.
Click “Send” button to post the data."
For more detail, refer to my config:
POST Request on iotagent-json
GET Request from Orion context broker

Related

No Traces in Azure API Response

The Flag Ocp-Apim-Tracehas been set to true.
The API Response displays this information under the Trace Tab:
Trace location was not specified in the response or trace log is not
available.
Yet no traces are available. How does one resolve this?
To enable trace, you need to include "Ocp-Apim-Trace" and "Ocp-Apim-Subscription-Key" in request header.
If the API does not require subscription, you can still get admin subscription key in developer portal. This enforces that only admin can get tracing log. To get admin subscription key if you are an admin, go to Developer Portal -> Profile -> find your target API and copy the key.
The Ocp-Apim-Trace feature enables you to specify whether or not APIM should generate a trace file on blob storage.
Setting the header to 'true' within Postman for example, will give you back a HTTP Header in the response called Ocp-Apim-Trace-Location.
This will contain the URL to your trace file, which you can open in any browser.
You might want to install a plugin/extension to be able to format JSON files properly in order to make it easy to read.
Just setting the flag Ocp-Apim-Trace to true will not suffice.
One needs to set the subscription key as well as per this doc.
https://learn.microsoft.com/en-us/azure/api-management/api-management-advanced-policies#Trace
So, for API's which do not have a subscription key, not sure how one can get the traces

How to use JSON variable of GET request in other HTTP request?

I'm really new in JMeter.
Tenant has Multple Environments
I have a test plan to create a Tenant, Get the tenant list. And then i have a JSON Extractor to save the Tenantid in order to create automatly an Environment in the desired tenant.
JSON Extractor:
then I set a Header manager to use the ID of this tenant to create the Environment in the Tenant
My HTTP request is set like this
[enter image description here][3]
But it doesn't work. Can you point me what i'm doing wrong?
Double check that your JSON Extractor works via Debug Sampler and View Results Tree listener combination. You should see tenantId variable value there. See How to Debug your Apache JMeter Script article for more details.
If you really need to send PATH HTTP Header make HTTP Header Manager a child of the next HTTP Request sampler to avoid any clash with other HTTP Header Manager instances. Mind that URL Path is not the same as HTTP Header named PATH
Check jmeter.log file for any suspicious entries.

I can`t connect from Node-RED to Freeboard.io using JSON

I trying to create a freeboard dashboard. I have a Arduino with four sensors that send their informations by mqtt. So, I on Node-RED I gen a JSON to response get request in /saida.
[{"id":"3f699b5.c91f064","type":"http response","z":"c7d4e8c8.509218","name":"","x":1184,"y":589,"wires":[]},{"id":"a3ed6250.1d64","type":"json","z":"c7d4e8c8.509218","name":"","x":1120.5,"y":540,"wires":[["3f699b5.c91f064"]]},{"id":"971f41c1.a1265","type":"function","z":"c7d4e8c8.509218","name":"","func":"msg.payload = {\"temperatura\":\"25\"}\nreturn msg;","outputs":1,"noerr":0,"x":1015.5,"y":584,"wires":[["a3ed6250.1d64"]]},{"id":"ed9f7a2a.604728","type":"http in","z":"c7d4e8c8.509218","name":"http in","url":"/saida","method":"get","swaggerDoc":"","x":850,"y":582,"wires":[["5b40d38c.5cc7ec","971f41c1.a1265"]]}]
In this moment, I`m using a static JSON to make a test. I have a use the host like:
my-public-host:1880/saida -> {"temperatura":"25"}
I access it by a proxy, the JSON returns ok. On ping.eu port check, the port is open. I ensure that my host is public.
But on my freeboard, I add it as datasource, then it says "never" update and I can`t read the JSON info.
What I should do to solve it?
I solved my problem.
There is a bug in freeboard.io. the thingproxy.freeboard.io don't work. The the browser don't let the freeboard.io make AJAX request for other link that isn't https. Besides, the browser don't let make a AJAX request for an other host.
There is two solutions:
Use sitelock on your host and add Access-Control-Allow-Origin to you response headers.
Use a https proxy and a browser extension to allow cross access.
bye!
Correct.
If the data source is flask based app, you can follow this link below to make freeboard read.
https://flask-cors.readthedocs.io/en/latest/

Selenium-Webdriver when i click something How to post and get response from server

When I click something on a web page I get a response from the server, but how can I catch and validate that response?
For example if I click the 'Flag' option in my webpage I get the following JSON response, but how can I validate it?
I tried this but it's not showing the full response message:
System.out.println(htmlPage.getWebResponse().toString());
you can use rest-assure library to check the server return response.Currently i use rest-assured library to do this.
here is a link from where u will get help.
How to get HTTP Response Code using Selenium WebDriver with Java?
The problem with using REST tools is that they will only return the response for a new, non-interactive request, i.e. outside the interactive Selenium flow. This won't give you access to the response for a click that Selenium has already initiated, which is most likely what you want.
If what you want to do is automatically capture the actual responses for all of the clicks you ask Selenium to do, e.g. upon the Flag, then #noor's link has a higher-rated answer that recommends using a proxy server to capture all requests and responses in a queriable form:
https://stackoverflow.com/a/19091306/954442
https://github.com/lightbody/browsermob-proxy#using-with-selenium
Using that technique, you will be able to query the complete response for the request you want, and you'll have access to all parameters, headers, response codes etc.

How to make REST Request to Baasbox server using POSTMAN extension?

I just installed Baasbox on my laptop and everything are work well. But when I try to make a request to create a new user, or anothe REST request using POSTMAN extension, I always got "Invalid Json" error. Is there any mistakes with my request?
it seems that you want to create a user.
In this case you have to set parameters like in the image below.
In particular you have to set "raw" instead of form-data, and also you do not need to set the Authorization header when signing up.
Further info here: BaasBox Signup API