Lists all templates of an user.You can also filter templates by name using the query parameter.
query
Here’s a sample request to list all user’s templates:
GET /v1/templates
fetch(`https://api.templated.io/v1/templates?query=Template%20Name`, { method: 'GET', headers: { 'Authorization': `Bearer ${API_KEY}` }}).then(response => response.json()).then(data => console.log(data)).catch(error => console.error('Error:', error));
import requests api_key = 'API_KEY'url = 'https://api.templated.io/v1/templates'params = {'query': 'Template Name'}headers = {'Authorization': f'Bearer {api_key}'} response = requests.get(url, params=params, headers=headers) if response.status_code == 200: print(response.json())else: print('Request failed. Response code:', response.status_code) print(response.text)
import java.net.HttpURLConnection;import java.net.URL;import java.io.BufferedReader;import java.io.InputStreamReader;import java.net.URLEncoder; public class ListTemplates { public static void main(String[] args) { try { String apiKey = "API_KEY"; String query = URLEncoder.encode("Template Name", "UTF-8"); URL url = new URL("https://api.templated.io/v1/templates?query=" + query); HttpURLConnection connection = (HttpURLConnection) url.openConnection(); connection.setRequestMethod("GET"); connection.setRequestProperty("Authorization", "Bearer " + apiKey); int responseCode = connection.getResponseCode(); if (responseCode == HttpURLConnection.HTTP_OK) { BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream())); String inputLine; StringBuilder response = new StringBuilder(); while ((inputLine = in.readLine()) != null) { response.append(inputLine); } in.close(); System.out.println(response.toString()); } else { System.out.println("Request failed. Response Code: " + responseCode); } } catch (Exception e) { e.printStackTrace(); } }}
<?php$apiKey = 'API_KEY';$query = urlencode('Template Name');$url = "https://api.templated.io/v1/templates?query={$query}"; $options = [ 'http' => [ 'header' => "Authorization: Bearer {$apiKey}\r\n", 'method' => 'GET' ]]; $context = stream_context_create($options);$result = file_get_contents($url, false, $context); if ($result === FALSE) { echo "Error fetching data";} else { $data = json_decode($result, true); print_r($data);}?>