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 Awesome New Mozilla Technologies You’ve Never Heard Of

    5 Awesome New Mozilla Technologies You’ve Never Heard Of

    My trip to Mozilla Summit 2013 was incredible.  I’ve spent so much time focusing on my project that I had lost sight of all of the great work Mozillians were putting out.  MozSummit provided the perfect reminder of how brilliant my colleagues are and how much…

  • 7 Essential JavaScript Functions

    7 Essential JavaScript Functions

    I remember the early days of JavaScript where you needed a simple function for just about everything because the browser vendors implemented features differently, and not just edge features, basic features, like addEventListener and attachEvent.  Times have changed but there are still a few functions each developer should…

  • Spatial Navigation

    Spatial Navigation

    Spatial navigation is the ability to navigate to focusable elements based on their position in a given space.  Spatial navigation is a must when your site or app must respond to arrow keys, a perfect example being a television with directional pad remote.  Firefox OS TV apps are simply…

  • Custom Scrollbars in WebKit

Source link
spot_img

Related articles

6 Zero-Days in March 2025 Patch Tuesday – Krebs on Security

Microsoft today issued more than 50 security updates for its various Windows operating systems, including fixes for a...

Z890 vs B860: Which Chipset Should You Choose? – Custom Gaming & Workstation PC Blog

As a long-time system builder, understanding the nuances between Intel’s Z890 and B860 chipsets is crucial for optimizing...

Jonas Event Technology Welcomes Sarah Cox as New Managing Director

Jonas Event Technology (JET), a leading provider of event registration services and technology, is proud to...

Drive Operational Excellence with Odoo ERP software Solutions

Unlocking Operational Excellence Businesses that leverage ERP solutions like Odoo ERP have seen significant improvements in their operational...