Emberjs Services

How to pass header as a parameter for an individual API in emberJS

Hi @SHASHWAT_SAHAY, welcome!

This depends on how you’re making your requests. If you’re using fetch you can just set the headers on the hash that you’re passing to the fetch method.

I assume you’re using Ember Data. In that case, what version of Ember/Ember Data are you using? If you’re up to date you could try using the new RequestManager API. If you’re on legacy Ember Data you probably want to:

  1. define a custom adapter for whatever API resource you need special headers for
  2. customize the headers property on the adapter