I want to use the below cURL
command with the axios
. How I can do that?
curl -XPOST -d 'url=https%3A%2F%2Fgoogle.com%2F' 'https://goolnk.com/api/v1/shorten'
I have tried in this way but seems to be incorrect:
axios.post("https://goolnk.com/api/v1/shorten", {
url: "https%3A%2F%2Fgoogle.com%2F"
}).then(function (response) {
console.log(response)
})
You almost made it, but url
key should just be a link string, without any special symbols.
axios
.post('https://goolnk.com/api/v1/shorten', { url: 'https://google.com' })
.then((res) => {
console.log(res.data);
});
Please, don't post code as images in the future, instead insert it as code block in the text.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.