httpPost to httpClient

Hi,

I am trying to convert from system.net.httpPost to system.net.httpClient. Can anyone help me?

Original:

system.net.httpPost(postUrl,"application/json","{\"value1\":\"" + str(value1) + "\"}")

Change to:

postResult = clientPost.post(postUrl,'application/json',{"machine_number":"string"})

Error:

{"detail":[{"type":"missing","loc":["body"],"msg":"Field required","input":null}]}

Thank you.

Use explicit parameter names:
data={your payload}

1 Like