How to Create a GET Request API Call with Query String using Axios

Published 2023-05-04

Hey folks, welcome back to another axios article. This article will show you a simple way how to write your GET API request with query string using npm package axios.

Use Axios params

We can use the params object within the AxiosRequestConfig. Here is the example code on how it looks:

import axios from 'axios'; axios.get('', { params: { a: 1, b: 2 }, });

The above code will convert your GET API call URL to:

There you go and I hope you find this piece useful.