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 More HTML5 APIs You Didn’t Know Existed

    5 More HTML5 APIs You Didn’t Know Existed

    The HTML5 revolution has provided us some awesome JavaScript and HTML APIs.  Some are APIs we knew we’ve needed for years, others are cutting edge mobile and desktop helpers.  Regardless of API strength or purpose, anything to help us better do our job is a…

  • Convert XML to JSON with JavaScript
  • Chris Coyier’s Favorite CodePen Demos II

    Chris Coyier’s Favorite CodePen Demos II

    Hey everyone! Before we get started, I just want to say it’s damn hard to pick this few favorites on CodePen. Not because, as a co-founder of CodePen, I feel like a dad picking which kid he likes best (RUDE). But because there is just so…

  • Using MooTools to Instruct Google Analytics to Track Outbound Links

    Using MooTools to Instruct Google Analytics to Track Outbound Links

    Google Analytics provides a wealth of information about who’s coming to your website. One of the most important statistics the service provides is the referrer statistic — you’ve gotta know who’s sending people to your website, right? What about where you send others though?


Source link
spot_img

Related articles

I Love My Backyard and the Right Outdoor Tech Makes It a Family Haven

I still love hanging out on my deck in the fall, even as the weather gets chilly. It's...

The Sunday Papers | Rock Paper Shotgun

The Sunday Papers is our weekly...

DDoS Botnet Aisuru Blankets US ISPs in Record DDoS – Krebs on Security

The world’s largest and most disruptive botnet is now drawing a majority of its firepower from compromised Internet-of-Things...

Sceptre 30-inch Curved Gaming Monitor Review

Key Features2560×1080 resolution200Hz refresh rateBuilt-in speakersUltra-wide displayCurved screenMultiple portsPros & ConsProsImmersive designHigh performanceSolid buildVibrant colorsValue priceConsLimited adjustabilitySpecific compatibilityBasic...