How to Add a Header to a curl Request

Date:

Share post:

curl is one of those great utilities that’s been around seemingly forever and has endless use cases. These days I find myself using curl to batch download files and test APIs. Sometimes my testing leads me to using different HTTP headers in my requests.

To add a header to a curl request, use the -H flag:

curl -X 'GET' \
 'https://nft.api.cx.metamask.io/collections?chainId=1' \
 -H 'accept: application/json' \
 -H 'Version: 1'

You can add multiple headers with multiple -H uses. Header format is usually [key]: [value].

Request Metrics real user monitoring
Request Metrics real user monitoring
Request Metrics real user monitoring
  • 5 Ways that CSS and JavaScript Interact That You May Not Know About
  • Animating CSS3 Transforms with MooTools Fx
  • Degradable SELECT onChange

    Degradable SELECT onChange

    Whenever I go to Google Analytics I notice a slight flicker in the dropdown list area. I see a button appear for the shortest amount of time and the poof! Gone. What that tells me is that Google is making their site function…

  • Xbox Live Gamer API

    Xbox Live Gamer API

    My sharpshooter status aside, I’ve always been surprised upset that Microsoft has never provided an API for the vast amount of information about users, the games they play, and statistics within the games. Namely, I’d like to publicly shame every n00b I’ve baptized with my…


Source link
spot_img

Related articles

Surveillance, spyware, and self-driving snafus • Graham Cluley

A Mexican drug cartel spies on the FBI using traffic...

Urgent Apple AirPlay Security Alert Sounds For Billions Of Devices

Do you use AirPlay to send videos from an iPhone,...

Event Accreditation and Access Control: Industry Trends and Future

The events industry is experiencing an unprecedented technological transformation, especially regarding event access control and accreditation systems. Attendee...

A Content Model Is Not a Design System – A List Apart

Do you remember when having a great website was enough? Now, people are getting answers from Siri, Google...