Forum Discussion
problems with POST call on REST API
- 4 years ago
Hi Anonymous
Try explicitly using HTTPS, your query currently is not.
https://localhost:5000/v1/api/iserver/secdef/searchRegards
Phil
Hi
Thanks for the previous help (I had done a search to see a list of valid header elements, but didn't find one which looked relevant, hence the querie on syntax).
Adding and therfore making the Headers - ... [#"Content-Type" = "application/json", Accept = "application/json"] has not worked.
I am still getting the following error:
DataSource.Error: The underlying connection was closed: The connection was closed unexpectedly.
Details:
localhost:5000/v1/api/iserver/secdef/search
I modifiied my code to make it static (i.e. not a function in M):
let
url = "localhost:5000/v1/api/iserver/secdef/search",
//cookiestr = "get the value of bm_sv cookie from browser",
headers = [#"Content-Type" = "application/json", Accept = "application/json"], //, Cookie = cookiestr],
body = Json.FromValue(
//body = Text.ToBinary(
[
symbol = "BHP",
name = false,
secType = "STK"
//exchange = "ASX"
]
),
//Content = Text.ToBinary(body),
response = Web.Contents(
url,
[
//RelativePath = "iserver/secdef/search",
Headers = headers,
Content = body
]
),
jsonResponse = Json.Document(response)
in
jsonResponse
Are there any other paths that may yield some response ?
Cheers
RT