7

I'm creating a group of queries that will all share the exact same set of headers.

Is it possible to create the group of headers once and then copy/paste them to other queries? Or, even better, can I assign a known group of headers to multiple queries?

Jedidja
  • 16,610
  • 17
  • 73
  • 112
  • You can set single key value elements in an environment and then reuse these so that you can change them all at once later, but as far as I can tell there's nothing about groups of headers. – Kilian Mar 30 '15 at 16:51
  • @KilianKoeltzsch I couldn't find it either; the app developers ask us to submit queries to SO (http://luckymarmot.com/paw/support), although I did email them to point out that Apple SE is the more applicable place. I'm hoping this might become a feature request... – Jedidja Mar 30 '15 at 17:34
  • Please ask the question on SO (as recommended by the developers), there are a bunch of question about paw already there and you will get faster responds than here (where we didn't even have a tag yet) – nohillside Mar 31 '15 at 04:50
  • I asked about this in Meta (http://meta.stackexchange.com/questions/252360/are-there-any-guidelines-around-which-se-site-should-host-a-given-question-tag?noredirect=1#comment824183_252360), and since it's a dev tool I guess we should move it there. I think we need a `paw-app` tag created over on SO, though – Jedidja Mar 31 '15 at 15:41
  • @Jedidja thanks for asking on Meta about the tags. I edited all questions to use "paw-app". – Micha Mazaheri Apr 06 '15 at 14:54
  • @Micha Mazaheri - We're 6 years down the line from you making it a priority, is there any sign of this getting done? Seems that the pace of dev on Paw in general has reached a glacial pace and I'm on look out for something else now myself. – mysomic Apr 22 '21 at 12:14

2 Answers2

2

The best way to do so is to have an environment domain for that. Make one variable per header, you may have a variable called Content-Type (as an example) and give it the application/json value for one environment, or application/xml for another environment. This way you'll be able to switch between JSON and XML in many requests at once.

Example of using Paw environments to switch headers

In the example above, there are 2 variables set, one for the Content-Type and another one for Accept. Both variable are then used in the request. As you can see in the preview at the bottom, the variables are replaced by their values in the HTTP request.

Micha Mazaheri
  • 3,481
  • 1
  • 21
  • 26
  • 1
    I understand we can set environment variables, but when I create a new request, I want to have a group of headers (all with the same value) automatically added. Basically, given an environment, I would like to have several headers (including values) assigned to the request. Creating environment variables still means I have to manually add the headers one-by-one to the request. – Jedidja Apr 07 '15 at 14:15
  • 4
    Yeah, I understand that. I guess then, I'll take it as a feature request. It would definitively be nice to have :) For a long time, I wanted to have request groups be able to add default Headers or even URL Parameters. I guess associating default headers to environments would be awesome! Thanks for the suggestion! – Micha Mazaheri Apr 08 '15 at 10:33
  • 1
    I'll accept the answer as "no, there is currently no way to do this, but it may happen in the future" :) Thanks for listening! – Jedidja Apr 08 '15 at 16:23
  • Or "here's a workaround until it gets properly added" :D thanks! – Micha Mazaheri Apr 08 '15 at 17:49
  • I really wish for this request. Just trying to hack my .paw file to copy headers over. I get so fat only to realised that each header can only has one parent(request) regardless of the content it link to(environment). I'm having 10 headers that need to be copy over to 9 requests. I'm pondering if I should just copy the request itself then paste over the body and url. – RobGThai Aug 23 '15 at 21:24
  • 1
    Editing .paw files manually is such a mess. I'll make a batch update feature a priority! – Micha Mazaheri Aug 25 '15 at 22:59
  • @MichaMazaheri did you add a way to update paw file easily as you mentioned? – Nicolas Lauquin Aug 31 '18 at 15:59
  • 1
    @MichaMazaheri do you have any news on this? It would be awesome! :) – Nuno Gonçalves Jan 22 '19 at 15:55
2

Old question, but still relevant. The answer still appears to be no, and hopefully @Micha Mazaheri still intends to implement it.

As an alternative, I create a Group called "_templates", then I'll have one request for logical request type. For example I will have a request with Auth headers set, or one for simple guest routes.

When it comes time for a new request, I simply right click and duplicate.

enter image description here

enter image description here

Chris
  • 54,599
  • 30
  • 149
  • 186