Cloud Toolkit
Welcome to the Cloud Toolkit API, a powerful set of tools designed to streamline your development process. Whether you're generating thumbnails, uploading files, or handling complex image manipulations, our API provides reliable and easy-to-use solutions.
Thumbnail and Image Generator
/api/thumbnail-generator/generate
Method: GET
Description: Generate a thumbnail from an image URL.
Query Parameters:
- url: The URL of the image.
- size: The size of the thumbnail.
Usage Examples:
fetch('https://toolkits.cloudmateria.com/api/thumbnail-generator/generate?url=https://example.com/image.jpg&size=300')
.then(res => res.blob())
.then(blob => {
const url = URL.createObjectURL(blob);
console.log(url);
});
/api/image-generator/profile
Method: GET
Description: Generate a profile image based on first name and last name.
Query Parameters:
- firstName: The first name.
- lastName: The last name.
- bgColor (optional): The background Color (HEX only).
- fgColor (optional): The foreground Color (HEX only).
Usage Examples:
fetch('https://toolkits.cloudmateria.com/api/image-generator/profile?firstName=John&lastName=Doe&bgColor=ffffff&fgColor=000000')
.then(res => res.blob())
.then(blob => {
const url = URL.createObjectURL(blob);
console.log(url);
});
/api/image-generator/text
Method: GET
Description: Generate a text initial image based on text.
Query Parameters:
- text: The text.
- bgColor (optional): The background Color (HEX only).
- fgColor (optional): The foreground Color (HEX only).
Usage Examples:
fetch('https://toolkits.cloudmateria.com/api/image-generator/text?text=CM&bgColor=ffffff&fgColor=000000')
.then(res => res.blob())
.then(blob => {
const url = URL.createObjectURL(blob);
console.log(url);
});
QR Code Generator
/generate_qr
Method: GET
Description: Generates a QR Code with customizable options such as size, color, and optional icon.
Query Parameters:
- data: The data to encode in the QR Code (required).
- size: The size of the QR Code in the format
widthxheight(optional, default:150x150). - icon: URL or file path of the icon to overlay in the center (optional).
- color: Hex color code for the QR Code (optional, default:
0b4358). - iconPadding: Padding between the icon and its circular border (optional, default:
10).
Usage Examples:
fetch('https://qrcode-gen.cloudmateria.com/generate_qr?data=HelloWorld&size=200x200&color=0b4358')
.then(res => res.blob())
.then(blob => {
const imgURL = URL.createObjectURL(blob);
console.log(imgURL);
});
Philippine Address
/api/v1/ph/regions
Method: GET
Description: Retrieve a list of regions.
Query Parameters:
- regCode: Filter by region code (optional).
Usage Examples:
fetch('https://phaddress.cloudmateria.com/api/v1/ph/regions')
.then(res => res.json())
.then(data => console.log(data));
/api/v1/ph/provinces
Method: GET
Description: Retrieve a list of provinces.
Query Parameters:
- regCode: Filter by region code (optional).
- provCode: Filter by province code (optional).
Usage Examples:
fetch('https://phaddress.cloudmateria.com/api/v1/ph/provinces?regCode=01')
.then(res => res.json())
.then(data => console.log(data));
/api/v1/ph/citymuns
Method: GET
Description: Retrieve a list of cities/municipalities.
Query Parameters:
- regCode: Filter by region code (optional).
- provCode: Filter by province code (optional).
Usage Examples:
fetch('https://phaddress.cloudmateria.com/api/v1/ph/citymuns?provCode=0128')
.then(res => res.json())
.then(data => console.log(data));
/api/v1/ph/barangays
Method: GET Description: Retrieve a list of barangays.
Query Parameters:
- regCode: Filter by region code (optional).
- provCode: Filter by province code (optional).
- citymunCode: Filter by city/municipality code (optional).
Usage Examples:
Two Factor Authentication
/api/2fa/generate
Method: POST
Description: Generate a 2FA secret and a QR code for an authenticator app (like Google Authenticator).
Body Parameters (JSON):
- username (string, required): Username of the account.
- appName (string, required): The name of the application.
Example Request Body:
{
"username": "johndoe",
"appName": "MyApp"
}
Response Example:
{
"secret": "JBSWY3DPEHPK3PXP",
"qrCodeDataUrl": "data:image/png;base64,iVBORw0K..."
}
/api/2fa/verify
Method: POST
Description: Verify a 2FA token (TOTP) using the provided secret.
Body Parameters (JSON):
- secret (string, required): Base32-encoded secret.
- token (string, required): Token from the authenticator app.
Example Request Body:
{
"secret": "JBSWY3DPEHPK3PXP",
"token": "123456"
}
Response Example:
{
"verified": true
}
Usage Examples:
import axios from 'axios';
// First, POST to generate 2FA
axios.post('https://2fa.cloudmateria.com/api/2fa/generate', {
username: 'johndoe',
appName: 'MyApp'
})
.then(res => {
console.log('2FA Secret:', res.data.secret);
console.log('QR Code URL:', res.data.qrCodeDataUrl);
// Display QR code to user and get token
const secret = res.data.secret;
const token = '123456'; // User-provided token from authenticator app
// Then, POST to verify
return axios.post('https://2fa.cloudmateria.com/api/2fa/verify', {
secret,
token
});
})
.then(res => {
console.log('Verification:', res.data);
})
.catch(err => console.error(err));