Click here to Skip to main content
15,882,017 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
0


I gave the method to be called by another person through ocelot, you need to insert json to this method

ocelot:

{
      "DownstreamPathTemplate": "/api/ClientPortalApi/ClientRequest_ISOOFER?contractDate={contractDate}",
      "UpstreamHttpMethod": [ "Get" ],
      "DownstreamScheme": "http",
      "DownstreamHostAndPorts": [
        {
          "Host": "skracanieumow.dev.ad.uclp",
          "Port": 80
        }
      ],
      "UpstreamPathTemplate": "/ContractShortening/IsOffer/{contractDate}"
    }

encoded json

%7b%0d%0a++%22contractNumber%22%3a+%2222%2f0546%2f21%22%2c%0d%0a++%22month%22%3a+10%2c%0d%0a++%22year%22%3a+2022%0d%0a%7d
First way - his try (another person)

ContractShortening/IsOffer/%7b%0d%0a++%22contractNumber%22%3a+%2222%2f0546%2f21%22%2c%0d%0a++%22month%22%3a+10%2c%0d%0a++%22year%22%3a+2022%0d%0a%7d

and it dont work - 404 from another company / 400 if I try


What I have tried:

Second way - I try

https://ocelot.dev.ad.uclp/ContractShortening/IsOffer/%7BcontractDate%7D?contractDate=%7b%0d%0a++"contractNumber"%3a+"22%2f0546%2f21"%2c%0d%0a++"month"%3a+10%2c%0d%0a++"year"%3a+2022%0d%0a%7d

and it work - i add

%7BcontractDate%7D?contractDate= 
//-- so
 {contractDate}?contractDate=
Questions:

is the way it passes the json to the method wrong?

can anything be done better here?

should I give them this code?

{contractDate}?contractDate=

should i do something different?
Posted
Updated 20-Dec-22 8:44am
Comments
Richard Deeming 19-Dec-22 4:56am    
We have no idea what the receiving code looks like. But passing a JSON document in the URL seems like a very bad idea. Aside from all the encoding issues, you could quickly bust the "maximum URL length" settings on your server, on in the browser.

Why not use a POST or PUT request instead?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900