I tried to check the operation of http request (Put) with Talented API Tester

It is posted as a memorandum. I would appreciate it if you could comment if there are any deficiencies.

Introduction

This article This is a memorandum when a super beginner finally confirmed the operation of Put request using [** Talented API Tester **](about ## Talented API Tester).

** Details of the program tested this time ** Languages used: Java8, Java Servlet

Type: Put request Data passed in the request: JSON format Data to be sent in response: JSON format

We have confirmed this operation.

About Talented API Tester

It is an extension of Google Chrome. If you use this, you can check the operation of server-side programs under development.

Download here [https://chrome.google.com/webstore/detail/talend-api-tester-free-ed/aejoelaoggembcahagimdiliamlcdmfm )

Talented API Tester for beginners here (Other pages in Qiita)

The official outline is here

For those who have not solved the problem even after looking at the above site

Even if I looked at the above site, it didn't make sense. (The person who writes is not bad. I have no knowledge) So from here on, like me, is it a beginner and http communication? ?? server? ?? I will write it for people in that state. (To me who is forgetful)

Http communication and the mechanism of Servlet are prerequisite knowledge. Please check each one.

Rough flow of things to do

―― 1. Create a request you want to send to your server (your app, program) --Create a new request --Method selection --Address input --HEADER and BODY input

―― 2. Start your own server ―― 3. Send a request ―― 4. Check the response → End the test if the response is intended

1. 1. Make a request

Make a request with this Tester that you want to send to your server (your app, program).

Create a new request

To make a request, you need to make a Project. So click "+ Project" Create a new project.

At this time, it is okay to decide the name of the project appropriately. I created a project called "aaa". It looks like this when created.

キャプチャ2.PNG

Then, "add request" will appear in the center of the screen, so click on it to create a new request. (The name is appropriate and OK)

I'm naming it "Request1" that was entered from the beginning. キャプチャ3.PNG

Method selection

In the initial state, it is "GET", so select the method you want to test. I want to test PUT requests, so I use "PUT".

Like this キャプチャ4.PNG

Address input

Well, this is the most difficult. I do not understand the meaning. But this time, I will not explain the address (URL?) In detail.

(** Addendum **: A kind person explained the address used this time in the comment. → Here)

It's just a test, so consider using the local loopback address to access the local server.

The address you actually enter looks like this http://127.0.0.1:8080 [path in the server? ]

I am [path in the server? Because] is specified as "/ api / notes" http://127.0.0.1:8080/api/notes

It will be.

This "api / notes" is the directory specified by the following code of Java Servlet. (It is described in the file of the program you want to test)

@WebServlet(
    name = "CreateNewNote",
    urlPatterns = {"/api/notes"}
)

So [path in the server? Enter the appropriate url Patterns according to the source code (method) you want to test.

When you enter キャプチャ7.PNG

Header and BODY input

header

This time we will send JSON format data, so click "JSON" at the bottom of the BODY frame Then HEADER will automatically change to "Content-Type: application / json". I'm happy.

Click to see

キャプチャ6.PNG

BODY input

Check out the common JSON format description.

Here, I will write notes when actually inputting to BODY.

** Indents, spaces and line breaks are NG ** ** Indents, spaces and line breaks are NG **

So, for example, when sending "title" and "body"


 {"title": "Title", "body": "Content"}

Please enter. If you put a space strangely, it will not be recognized correctly (crying)

If you pay attention to this and enter BODY, it will be like this.

キャプチャ9.PNG

Your request is now complete! !! !! !! I'm happy.

2. Start the server

Start the local server when you make a request.

This depends on each execution environment, but in the case of eclipse, click "Run" → select server Will start the local server.

3. 3. Send a request

Send the request created in 1. Click the blue "Send" button on the right side of the screen

キャプチャ9.PNG

4. Check the response

Click the "Send" button and the response will be displayed below the request as shown in the image below.

If it works キャプチャ10.PNG

This time, I'm writing code to create a class using the data passed in the request and send it back in JSON. It seems that it is working safely according to the specifications.

By the way, if it doesn't work, it looks like this キャプチャ11.PNG

The number written in this colored part is a number called "Http status code", and the number is decided for each type of error. So please check it out.

Afterword

Above

A memorandum when a super beginner finally confirmed the operation of Put request using [** Talented API Tester **](about ## Talented API Tester)

Is the end.

I would like to publish the source code of the Put request that sent this request in another article.

Recommended Posts

I tried to check the operation of http request (Put) with Talented API Tester
I tried to check the operation of gRPC server with grpcurl
I tried to solve the problem of "multi-stage selection" with Ruby
I tried to build the environment of PlantUML Server with Docker
I tried to summarize the Stream API
I tried to visualize the access of Lambda → Athena with AWS X-Ray
I tried to measure and compare the speed of GraalVM with JMH
I tried to compare the infrastructure technology of engineers these days with cooking.
I tried to summarize the state transition of docker
05. I tried to stub the source of Spring Boot
I tried to reduce the capacity of Spring Boot
I tried to draw animation with Blazor + canvas API
[Beginner's point of view] I tried to solve the FizzBuzz problem "easily" with Ruby!
How to request by passing an array to the query with HTTP Client of Ruby
I tried to investigate the mechanism of Emscripten by using it with the Sudoku solver
I tried to make a product price comparison tool of Amazon around the world with Java, Amazon Product Advertising API, Currency API (2017/01/29)
I tried to increase the processing speed with spiritual engineering
I tried to summarize the basics of kotlin and java
[Swift] I tried to implement the function of the vending machine
Check the operation of two roles with a chat application
I tried to summarize the basic grammar of Ruby briefly
I tried to link chat with Minecraft server with Discord API
What I was addicted to with the Redmine REST API
I tried to build the environment of WSL2 + Docker + VSCode
I tried upgrading from CentOS 6.5 to CentOS 7 with the upgrade tool
I want to understand the flow of Spring processing request parameters
I tried to express the result of before and after of Date class with a number line
I tried to implement the image preview function with Rails / jQuery
I tried to build an http2 development environment with Eclipse + Tomcat
I tried to interact with Java
I tried to explain the method
I tried to take a look at the flow of Android development environment construction with Android Studio
I tried to summarize the methods of Java String and StringBuilder
I was addicted to the API version min23 setting of registerTorchCallback
I tried to solve the problem of Google Tech Dev Guide
A story that I wanted to write a process equivalent to a while statement with the Stream API of Java8
I tried to make a machine learning application with Dash (+ Docker) part1 ~ Environment construction and operation check ~
[Spring Boot] I investigated how to implement post-processing of the received request.
I tried to summarize the key points of gRPC design and development
[Ruby] I tried to diet the if statement code with the ternary operator
I tried to make a Web API that connects to DB with Quarkus
How to convert an array of Strings to an array of objects with the Stream API
I tried to solve the tribonacci sequence problem in Ruby, with recursion.
I tried to make full use of the CPU core in Ruby
After all I wanted to preview the contents of mysql with Docker ...
Check the operation using jetty with Maven.
I tried to summarize the methods used
Check the contents of params with pry
I tried to get started with WebAssembly
I tried to implement the Iterator pattern
I tried to implement ModanShogi with Kinx
Check the operation of the interface through threads
I want to control the start / stop of servers and databases with Alexa
I tried to implement a function equivalent to Felica Lite with HCE-F of Android
What I tried when I wanted to get all the fields of a bean
03. I sent a request from Spring Boot to the zip code search API
I tried to get the distance from the address string to the nearest station with ruby
[Ruby] Sending a POST HTTP request to the Web API using OAuth authentication
Rails6 I want to make an array of values with a check box
I tried to clone a web application full of bugs with Spring Boot
I want to separate the handling of call results according to the API caller (call trigger)