Search code examples
xmlasp.net-web-apiputpostman

Content sent to API is truncated


I'm using PostMan to re-send (Xml) content to a webAPI method. Unfortunately the Xml content is being truncated at the point where > is being specified in the string (the xml contains an attribute that has xml already url encoded)

I cannot change the format of the xml, as it's already in use from the application as I'm just pulling the value from a table in sql, and reposting it to the api for testing purposes. and I need to be able to pull the data as-is, and repost it to the api via PostMan with very little effort (I may have to do this repeatedly with different data).

The API signature is:

public HttpResponseMessage Put([FromBody]string userDataSetString, [FromUri(Name = "V")]string apiVersion)

And the data this is what I have in PostMan:

Postman Settings

When I execute this against the API, the userDataSetString parameter has:

<Test Value="

Is there something I need to add to the header to allow it to cope with this?

EDIT As an alternative, I will also take any answer that has me store the xml in a file, and attach it in postman for sending.


Solution

  • So I figured out that the problem was due to the presence of & in the code.

    Prior to inserting my data into the Postman RAW text window, I needed to do a global replace on & with %26

    Before

    =<Test Value="&gt;Data"></Test>
    

    After

    =<Test Value="%26gt;Data"></Test>