Manage your image and video gallery by uploading and retrieving images/videos. Response will be a reference URL.
{"id": "1167335b-6c37-4fc6-ab8a-044e0005d335-jpeg","url": "https://images.ayrshare.com/q3Ls85VTsrbODnGIJHpy7PaHWwA3/1167335b-6c37-4fc6-ab8a-044ed885d-jpeg.jpeg","fileName": "fun.jpg","description": "good times"}
​
curl \-H "Authorization: Bearer API_KEY" \-H 'Content-Type: application/json' \-d '{"file": "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQ...", "fileName": "test.png", "description": "best image"}' \-X POST https://app.ayrshare.com/api/upload
const fetch = require("node-fetch");const API_KEY = "API_KEY";const base64 = "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQ...";​fetch("https://app.ayrshare.com/api/upload", {method: "POST",headers: {"Content-Type": "application/json","Authorization": `Bearer ${API_KEY}`},body: JSON.stringify({file: base64,fileName: "test.png",description: "best image"}),}).then((res) => res.json()).then((json) => console.log(json)).catch(console.error);
import requests​payload = {'file': 'data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQ...','fileName': "test.png",'description': "best image"}headers = {'Content-Type': 'application/json','Authorization': 'Bearer API_KEY'}​r = requests.post('https://app.ayrshare.com/api/upload',json=payload,headers=headers)print(r.json())
<?phprequire 'vendor/autoload.php'; // Composer auto-loader​$client = new GuzzleHttp\Client();$res = $client->request('POST','https://app.ayrshare.com/api/upload',['headers' => ['Content-Type' => 'application/json','Authorization' => 'Bearer API_KEY'],'file' => 'data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQ...','fileName' => "test.png",'description' => "best image"]);​echo json_encode(json_decode($res->getBody()), JSON_PRETTY_PRINT);
[{"id": "5553a26a-cffb-4a31-bd89-dee296d35648-jpeg","timeCreated": "2020-07-30T20:23:49.774Z","size": "223340","url": "https://images.ayrshare.com/LW8kx9Q5smXeJl5CujF7DxFAF1q1/5553a26a-cffb-4a31-bd89-dee296d35648-jpeg.jpeg","fileName": "test1.jpeg","description": "Test1"},{"id": "93383cc7-7a15-4d16-a5fa-fdda1f9bebe2-jpeg","timeCreated": "2020-07-30T20:24:57.421Z","size": "223340","url": "https://images.ayrshare.com/LW8kx9Q5smXeJl5CujF7DxFAF1q1/93383cc7-7a15-4d16-a5fa-fdda1f9bebe2-jpeg.jpeg","fileName": "test2.jpeg","description": "Test2"}]
​
curl \-H "Authorization: Bearer [API Key]" \-X GET https://app.ayrshare.com/api/media
const fetch = require("node-fetch");const API_KEY = "Your API Key";​fetch("https://app.ayrshare.com/api/media", {method: "GET",headers: {"Authorization": `Bearer ${API_KEY}`}}).then((res) => res.json()).then((json) => console.log(json)).catch(console.error);
import requests​headers = {'Authorization': 'Bearer [API_KEY]'}​r = requests.get('https://app.ayrshare.com/api/media', headers=headers)print(r.json())
<?phprequire 'vendor/autoload.php'; // Composer auto-loader​$client = new GuzzleHttp\Client();$res = $client->request('GET','https://app.ayrshare.com/api/media',['headers' => ['Content-Type' => 'application/json','Authorization' => 'Bearer API_KEY']]);​echo json_encode(json_decode($res->getBody()), JSON_PRETTY_PRINT);
using System;using System.Net;using System.IO;​namespace MediaGETRequest_charp{class Media{static void Main(string[] args){string API_KEY = "API_KEY";string url = "https://app.ayrshare.com/api/media";​var httpWebRequest = WebRequest.CreateHttp(url);httpWebRequest.ContentType = "application/json";httpWebRequest.Headers.Add("Authorization", "Bearer " + API_KEY);​var httpResponse = (HttpWebResponse)httpWebRequest.GetResponse();using (var streamReader = new StreamReader(httpResponse.GetResponseStream())){var response = streamReader.ReadToEnd();Console.WriteLine(response);}}}}