diff --git a/app/api/users/users.js b/app/api/users/users.js new file mode 100644 index 0000000..815d937 --- /dev/null +++ b/app/api/users/users.js @@ -0,0 +1,16 @@ +'use strict'; + +const $url = 'https://localhost:8000/api/v1/users'; + +const authorization = 'call_me_api_key_secret'; + +fetch(url, { + method: 'GET', + headers: { + Authorization: authorization, + 'Content-Type': 'application/json', + }, +}) + .then((response) => response.json()) // Parse the JSON response + .then((data) => console.log(data)) // Log the data + .catch((error) => console.error('Error:', error)); // Handle errors diff --git a/app/api/users/users.php b/app/api/users/users.php new file mode 100644 index 0000000..cc6ac25 --- /dev/null +++ b/app/api/users/users.php @@ -0,0 +1,19 @@ + diff --git a/app/api/users/users.py b/app/api/users/users.py new file mode 100644 index 0000000..f06edfb --- /dev/null +++ b/app/api/users/users.py @@ -0,0 +1,14 @@ +import requests # pip3 install requests + +url = "http://localhost:8000/api/v1/users" + +authorization = "call_me_api_key_secret" + +headers = { + 'Authorization': authorization, + 'Content-Type': 'application/json' +} + +response = requests.get(url, headers=headers) + +print(response.json()) \ No newline at end of file diff --git a/app/api/users/users.sh b/app/api/users/users.sh new file mode 100755 index 0000000..1fb31a4 --- /dev/null +++ b/app/api/users/users.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +url = "http://localhost:8000/api/v1/users"; + +authorization="call_me_api_key_secret" + +response=$(curl -s -X GET "$url" -H "Authorization: $authorization" -H "Content-Type: application/json") + +echo "$response"