How do I look into the response API from twitter? - json

I am using React and Express.js to make a toy project like a simple SNS website.
Normally that I know is the server sends a response to the client after receving a request from the client.
And response data type is JSON and it includes all informations about articles which is gonna be rendered on the viewport. And through Chrome devtools, I can see that JSON at 'Network > choose one of xhr > preview'.
Here is my question, I logged in Twitter and tried to check JSON-type response API of the articles through the same way but I couldn't find it.
How could I find it?
Is it encrypted like something 'Encrypt json serialized response'-ish?
I want to know that production level like Meta, Twitter. Thanks for reading! :)
What I did:
Logged in Twitter by my own account.
Opend Chrome Devtools and checked Network tab.
I clicked Type column to gather 'xhr'.
Lots of response typed xhr were there. I looked in one by one but I couldn't find it.
I just wanted to know the structure of JSON as a response API for about Twitter's articles(aka tweet) for real.

You can see the json payload and response by Chrome DevTool.
Steps
#1 Go twitter.com with your account with Chrome
twitter.com/your_account_name
It will be automatically login by cookie
#2 Open DevTool by pressing "F12"
#3 Select Network tab and press clear icon
if not, tweet keep to show event message
#4 Tweet your own message
#5 Stop Recoding icon after send Tweet
#6 Click CreateTweet in the Name section
#7 Click Header tab, can see HTTP call URL and post message with status
#8 Click Payload tab, can see JSON's format data with Tweet message
#9 Click Response tab, can see returned JSON data

Related

invalid_request could not parse claims parameter

I am having a problem making a request to the Banno Plugin I do not have this issue when the "View More" section is clicked. I belive that I have found the issue but looks like I cannot reach out to banno directly so wanted to see if there is anyone that has seen this issue.
When reaching out to the auth "a/consumer/api/v0/oidc/auth" endpoint I have assigned claims to the payload
{"userinfo":{"address":null,"birthdate":null}}
But when reviewing the error request I get a invalid_request could not parse claims parameter request on the claim but the claim is no longer the claim I gave it and is injecting /a/consumer/api to the first json object like below:
{"userinfo":{"address":/a/consumer/api,"birthdate":null}}
When I use the Card Action to this external application it works as expected but while in the plugin card it fails due to the parsed claim.
Any feedback would be helpful?
Out of curiosity, are you URL encoding the characters claims payload?
The example you've given:
{"userinfo":{"address":null,"birthdate":null}}
...would look like this once it is encoded:
%7B%22userinfo%22%3A%7B%22address%22%3Anull%2C%22birthdate%22%3Anull%7D%7D

How to use Postman and the FIWARE API?

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

How to use Twilio on REST client like Postman

Now I am at Stack Overflow as I could not get a simple answer elsewhere for my problem.
I need to send multiple messages with Twilio using Postman. I need to know the script and procedure how to do it. I would prefer JSON(application/json) under body>raw. And I would request if a screencast can be added to it.
Thanks in advance.
Open Postman, new tab for a new request
Select POST from the request type drop-down
Enter request URL
https://api.twilio.com/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Messages
(replace ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX with YOUR_TWILIO_ACCOUNT_SID)
Click on Authorization tab (it's under the request type drop-down) and then for the type select Basic Auth and you will see two fields Username and Password
Enter YOUR_TWILIO_ACCOUNT_SID for Username and YOUR_TWILIO_AUTH_TOKEN for Password
Next, click on the Body tab and make sure form-data is selected from the radio buttons. Here you need to enter Key Value pairs like in the picture below (but replace with your values, From must be your Twilio number):
Of course, click on the blue Send button

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 reverse engineer an http API call using REST console

I'm trying to replicate a request I make on a website (ie zoominfo.com) using the same http POST parameters using chrome rest console, but it fails for some reason. I'm not sure if there is a missing field or it's not working because the origin of the request isn't valid.. can someone point me out in the right direction? Below is a detailed explanation of the experiment:
ORIGINAL CASE
basically if I go to zoominfo.com (registered and all) I see a form page that I need to fill:
if I hit enter.. the site makes an ajax call. If I open the chrome web dev tools, and open the network tab, I see the details of the ajax call:
notice the body of the POST has the name John Becker in it:
{"boardMember":{"value":"Include","isUsed":true},"workHistory":{"value":"CurrentAndPast","isUsed":true},"includePartialProfiles":{"value":true,"isUsed":true},"personName":{"value":"john%20becker","isUsed":true},"lastUpdated":{"value":0,"isUsed":true}}
the response is shown under the respones tag:
WHAT I'M TRYING TO DO
basically replicate what i've done above using a REST console (note: so there is nothing illegal here.. i'm just replacing a chrome browser action with a rest client action.. i'm not hacking anyone and i'm not getting information I can't get the normal way, but if someone feels otherwise.. please let me know)..
so I plug in the same parameters as above into the rest console:
now i'm not sure about authentication.. but just to be safe, i entered the same user name and pwd i have for the site into the REST console:
but then I keep on getting an error as a response to my rest console's request:
UPDATE: CORRECT ANSWER:
so according to JMTyler's answer.. I had to simply include criteria in the RAW body, and convert it to url encoding.. in addition to that, I had to explicitly set the encoding in the rest console body..
looking at the chrome inspector more closely, it turns out that I simply had to click on view source:
to get the url-encoded value that I needed to put in the RAW body in the rest console:
I also had to set encoding to gzip,deflate,sdch and things worked fine!
The form is posting all that JSON under the field criteria. You can see this in the screencap of the chrome dev console you posted.
Just start your raw body in rest console with criteria= and make sure the json has been url-encoded. That should do it.
No authentication is needed because none is passed through the headers in your screencap. Any cookies you have when you load the page normally will also be loaded through rest console, so you don't need to worry about explicitly setting them.
Reading your problems I'll make an educated guess:
zoominfo does not provide an RESTful API.
Rest-Console understands and uses HTTP Authentication, which is different from the authentication handler zoominfo implemented.
A possible way to work around may be:
Make a call to the login-page via rest console. you'll get back cookies and a lot more.
In subsequent requests to zoominfo be sure to include those cookies (likely holding some session information) in your request, therefore acting like a browser.