Api : https://developers.onemap.sg/privateapi/auth/post/getToken

Hi ,

Below is my code in asp.net for the api " https://developers.onemap.sg/privateapi/auth/post/getToken"

   Dim request As HttpWebRequest
    Dim data As Byte()
    Dim stream As Stream
    Dim response As HttpWebResponse
    request = WebRequest.Create("https://developers.onemap.sg/privateapi/auth/post/getToken")
    PostData = "email=xxxx,password=yyyy"
    data = encoding.GetBytes(PostData)
    request.Method = "POST"
    request.ContentType = "application/form-data"
    request.ContentLength = data.Length
    stream = request.GetRequestStream()
    stream.Write(data, 0, data.Length)
    response = request.GetResponse()

The response Im receiving is “Error Code : 400 , Bad request” . Appreciate if I someone can help on this

Hi Jeena

You are having a 400 error due to “The server could not understand the request due to invalid syntax”. You may want to check your syntax again. For reference, you can go to

https://app.swaggerhub.com/apis/onemap-sg/new-onemap-api/1.0.0

where you can export sample calls of our API in your preferred language.

Thanks Junhong for your help .