Skip to content

Instantly share code, notes, and snippets.

@mininxd
Last active August 3, 2024 10:14
Show Gist options
  • Save mininxd/555c13f8bfdf786efc91b9f90d946b45 to your computer and use it in GitHub Desktop.
Save mininxd/555c13f8bfdf786efc91b9f90d946b45 to your computer and use it in GitHub Desktop.
how to use header on restAPI

CURL

curl --header "accept:application/json" https://api.mininxd.my.id/

JavaScript

fetch("https://api.mininxd.my.id/", {
   headers: {
   'accept':'application/json'
})

Axios

axios.get("https://api.mininxd.my.id/", {
   headers: {
   'accept':'application/json'
})

Python

install requests module first
$ python -m pip install requests

import requests

url = "https://api.mininxd.my.id/"
 headers = {
    "accept": "application/json"
}

response = requests.get(url, headers=headers)
result = response.json()
print(result)



if you found this gist from nowhere, try visit my homepage https://mininxd.my.id/ :'D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment