simplerestapi
v1.0.5
Published
A simple and simplified request generator.
Downloads
19
Maintainers
Readme
simplerestapi
A simple and simplified request generator.
API Reference
How to use
const {petitionType} = require("simplerestapi");
petitionType("API","method","data")
//Examples
const { petitionType, petitionTypeAuth } = require('simplerestapi');
// Example 1: Making a basic HTTP request
const apiUrl = 'https://api.example.com/data';
const requestData = { key: 'value' };
petitionType(apiUrl, 'GET', requestData);
// Example 2: Making an authenticated HTTP request
const authApiUrl = 'https://api.example.com/authenticated-data';
const authData = { username: 'exampleUser', password: 'secretPassword' };
const authToken = 'Bearer YOUR_ACCESS_TOKEN';
petitionTypeAuth(authApiUrl, 'POST', authData, authToken);
| Parameter | Type | Description |
| :-------- | :------- | :------------------------- |
| petitionType
| string
string
string
| Generates the API request |
| petitionTypeAuth
| string
type
string
string
| Generates API request but with token access |