Random doge Image Generator API is a free API that you can do it anywhere for free, this API works on GET requests. If you request, you will get JSON output in response, which you can use in your project. It is straightforward, you can use it in an easy way in languages like Javascript, Php, Python, etc. Javascript random dog image API,
How To Use Random Doge Image API
Random Doge Photo Generator API EndPoint
GET https://random.dog/woof.json
Random dog picture generator API is very easy to use, you will get an endpoint, and simply you have to make a GET request on it.
Only one image may be sent per request. The following image content types are supported Dog API free:
image/jpeg
image/png
image/gif
image/tiff
Animated gifs are supported. Use your power for good.
The response is an Image object within a data envelope. Example response The Dog API:
{ "fileSizeBytes": 122289, "url": "https://random.dog/6d07c332-b2b3-418e-a3ab-bb189e4bb899.jpg" }
How To Use Random Dog Image API
For PHP
<?php $curl = curl_init(); curl_setopt_array($curl, [ CURLOPT_URL => "https://random.dog/woof.json", 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://random.dog/woof.json', options) .then(response => response.json()) .then(response => console.log(response)) .catch(err => console.error(err));
Python
import requests url = "https://random.dog/woof.json" response = requests.request("GET", url) print(response.text)