₹0.00

No products in the cart.

₹0.00

No products in the cart.

API | Random Cat Photo Generator API

Random Cat Image Generator is a free API. You can use it for free. With its help, you can also create a Telegram bot and a website and earn money. It is very easy to do that. And you can do it in all programming languages.

Random Cat Photo Generator API

Random Cat Image generator API is very easy to use, you will get an endpoint, and simply you have to make a GET request on it.

GET https://api.thecatapi.com/v1/images/search

Only one image may be sent per request. The following image content types are supported Cat API free:

  • image/jpeg
  • image/png
  • image/gif
  • image/tiff

The response is an Image object within a data envelope. Example response TheCatAPI:

[
{
"id": "MTY1ODc5MA",
"url":"https://cdn2.thecatapi.com/images/MTY1ODc5MA.png",
"width": 638,
"height": 431
}
]

How To Use Random Cat Picture API

PHP

<?php

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://api.thecatapi.com/v1/images/search",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}

JavaScript

const options = {method: 'GET'};

fetch('https://api.thecatapi.com/v1/images/search', options)
  .then(response => response.json())
  .then(response => console.log(response))
  .catch(err => console.error(err));

Python

import requests

url = "https://api.thecatapi.com/v1/images/search"

response = requests.request("GET", url)

print(response.text)

For More Detail – https://docs.thecatapi.com/

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisement -spot_img

Latest