Search code examples
postman

Making a data payload available for multiple requests


Suppose I have an xml payload.

Request 1 targets API 1: API 1 is SOAP and as part of the request, should receive this xml payload as CDATA

Request 2 targets API 2: API 2 is RESTful and as part of the request, should receive this xml payload as a base64 encoded string.

Is there a way to establish this xml payload in a way that allows both requests to reference it?

For example, currently if that xml payload need to change, I would need to modify the corresponding property in the bodies of both Request 1 and Request 2. Instead, I'd like to modify just the xml payload.

Ex:

SOAP:

<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" >
  <soap:Header/>
  <soap:Body>
    <someOperation>
      <someProperty/>
      <someOtherproperty/>
      <etc/>
      <Data><![CDATA[<thatXmlPayload>a few thousand lines</thatXmlPayload]]>
  ...etc...

REST:

{
    "myProperty" : ...,
    "myOtherProperty" : ...,
    "etc" : ...,
    "content" : thatSameFewThousandLineXmlPayloadButBase64Encoded==
...etc...

Solution

  • Summary: No.

    Postman is a game changer from a tooling perspective for software engineers.

    That being said. It's a pretty dumb piece of 'software'. It's a sexy interface for a basic Request/Response life cycle.

    ... With the added benefits of the Postman Teams features which are really cool, but not related to this specific question.

    So no. Postman isn't going to do the work for you.

    Request/Response. You are responsible for defining the Request (including the payload) and Postman will handle the response to make it easy on the eye.

    I mean, what you are asking for is probably an extremely good idea, and one that I could personally see people I work with using. But your best approach for this would be to raise a Feature Request with Postman via their preferred method.

    But to directly answer your question. No. This is not possible. Just use the good old CTRL + C and CTRL + V.

    Unless you're working at scale, this is a mere 2 second inconvenience, not a real problem.