Unable to Connect Via postman


  • Hi All,
    Thanks in advance for everyone who are reading this post. ☺

    I am trying to connect to angelBroking from Postman using the below loginByPassword API.

    https://apiconnect.angelbroking.com/rest/auth/angelbroking/user/v1/loginByPassword

    Method Type: Post
    No Authorization

    a86a3d2a-b213-4bb7-993c-419fc66988b9-image.png
    These are the header values that i am sending for the request.

    In Body:
    {
    "clientcode": "L10XX71",
    "password": "xxxxxxxx",
    "totp": "697654"
    }

    but everytime, this is the response i get

    <html>
    <head><title>400 Bad Request</title></head>
    <body bgcolor="white">
    <center><h1>400 Bad Request</h1></center>
    <hr><center>nginx/1.14.1</center>
    </body>
    </html>

    I have read like most of the questions asked in Forum and online references, but none of them clears my issue. I read the API documentation many times, but couldnt find anything wrong with the values i am providing here.

    Can somone please help me with my issue.


  • @laskshmi did you try smartAPI2.0 and try using totp? are you copy paste totp generated when you do enable totp or use device to scan QR code?


  • @sagard

    You are not supposed to use this URL in postman. https://smartapi.angelbroking.com/publisher-login?api_key=xxx. You can use this url directly from browser and the token will be sent in the redirect URL which u mentioned while creating an APP in smart API.

    To get the jwtToken from postman use the below details
    https://apiconnect.angelbroking.com/rest/auth/angelbroking/user/v1/loginByPassword
    Method: POST
    No Authorization

    Headers:
    Content-Length:<postman generated values>
    Content-Type:<postman generated values>
    Accept:application/json
    X-ClientLocalIP:<ur client ip>
    X-ClientPublicIP:<ur public ip>
    X-MACAddress:<ur mac address>
    X-PrivateKey:<Your API KEY>
    X-UserType:USER
    X-SourceID:WEB
    

    Update your details ()in the header.

    BODY:

    {
        "clientcode": "{{clientID}}",
        "password": "{{clientPIN}}",
        "totp": "483811"
    }
    

    Hope this helps!!


  • @laskshmi

    Hello Laskshmi,

    Issue: Login request issue,

    I trayed to login through Postman API tool request. I set the header section as per the smart-API documentation and set the Bearer token key, which I get it once after totp as attached in the image. In the body section I sent the data as below

    Request URL:
    https://smartapi.angelbroking.com/publisher-login?api_key=xxx

    Param:
    api_key=xxx

    Body Section
    {
    "clientcode":"XXXXXXX",
    "password":XXXX,
    "totp":"XXXX"
    }

    Request Body
    {
    "clientcode":"clientcode",
    "password":"pin",
    "totp":"token"
    }

    Statuscode: 404Not Found
    empty response body

    Response Body
    {
    "timestamp": "2023-02-06T08:16:47.782+00:00",
    "status": 404,
    "error": "Not Found",
    "message": "",
    "path": "/"
    }

    //![alt text](image url)
    ![0_1675672673402_Query.png](Uploading 100%)

    Could you please have a look over the problem and help me with the same.


  • @laskshmi Thanks for sharing this.
    Regards,
    Jathagam porutham in tamil


  • @asiam9

    I finally connected to AB API using POSTMAN. Looks like I was just missing out an request header (feeling so stupid right now 😋). Below are the heder that u need to add in ur

    Postman Request Headers:
    44fc6765-0e3b-40a5-a183-40b1e620835e-image.png

    Just make sure u have all the selected headers (mandatory), remaining all are optional. THen hit send and u will receive 200 with the response .

    Hope this message helps u. 🙂


  • @laskshmi said in Unable to Connect Via postman:

    Hi All,
    Thanks in advance for everyone who are reading this post. ☺

    I am trying to connect to angelBroking from Postman using the below loginByPassword API.

    https://apiconnect.angelbroking.com/rest/moto x3m/auth/angelbroking/user/v1/loginByPassword

    Method Type: Post
    No Authorization

    a86a3d2a-b213-4bb7-993c-419fc66988b9-image.png
    These are the header values that i am sending for the request.

    In Body:
    {
    "clientcode": "L10XX71",
    "password": "xxxxxxxx",
    "totp": "697654"
    }

    but everytime, this is the response i get

    <html>
    <head><title>400 Bad Request</title></head>
    <body bgcolor="white">
    <center><h1>400 Bad Request</h1></center>
    <hr><center>nginx/1.14.1</center>
    </body>
    </html>

    I have read like most of the questions asked in Forum and online references, but none of them clears my issue. I read the API documentation many times, but couldnt find anything wrong with the values i am providing here.

    Can somone please help me with my issue.

    That is exactly my problem. If you've found a solution, please let me know.


  • @asiam9
    I started to try the JAVA SDK, i am able to successfully connect to angel one account. I Didnt try via postman after that. 😊


  • @laskshmi
    Same issue I am facing. Please let me know, if you resolved it.