URL Encoder/Decoder is a tool for encoding and decoding URL strings. It converts special characters to percent-encoded format and decodes them back for safe URL transmission.
npm install @apiverve/urlencodeshell
npm install @apiverve/urlencode
`
Using yarn:
`shell
yarn add @apiverve/urlencode
`
---
Configuration
Before using the URL Encoder/Decoder API client, you have to setup your account and obtain your API Key.
You can get it by signing up at https://apiverve.com
---
Quick Start
Get started with the Quick Start Guide
The URL Encoder/Decoder API documentation is found here: https://docs.apiverve.com/ref/urlencode.
You can find parameters, example responses, and status codes documented here.
$3
`javascript
const urlencodeAPI = require('@apiverve/urlencode');
const api = new urlencodeAPI({
api_key: '[YOUR_API_KEY]'
});
`
---
Usage
---
$3
Using the API is simple. All you have to do is make a request. The API will return a response with the data you requested.
`javascript
var query = {
"text": "Hello World & Goodbye",
"action": "encode"
};
api.execute(query, function (error, data) {
if (error) {
return console.error(error);
} else {
console.log(data);
}
});
`
---
$3
You can also use promises to make requests. The API returns a promise that you can use to handle the response.
`javascript
var query = {
"text": "Hello World & Goodbye",
"action": "encode"
};
api.execute(query)
.then(data => {
console.log(data);
})
.catch(error => {
console.error(error);
});
`
---
$3
You can also use async/await to make requests. The API returns a promise that you can use to handle the response.
`javascript
async function makeRequest() {
var query = {
"text": "Hello World & Goodbye",
"action": "encode"
};
try {
const data = await api.execute(query);
console.log(data);
} catch (error) {
console.error(error);
}
}
`
---
Example Response
`json
{
"status": "ok",
"error": null,
"data": {
"action": "encode",
"original": "Hello World!",
"result": "Hello%20World%21",
"original_length": 12,
"result_length": 17
}
}
``