Navigation

    SmartAPI Forum
    • Register
    • Login
    • Search
    • Categories
    • Popular
    • Groups
    • FAQs
    • API Docs

    Get Historical Data

    Bugs
    2
    4
    44
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • R
      RK last edited by

      @admin

      My Login ID is A734010

      I am able to Login and get different type of data like

      Funds and Margins, Generate Tokens and Get Profile to name a few. However when I try to access the GetCandleData I get an error saying Invalid Token. The response code is 400 and the error is AG8001.

      Here is the code:

      var axios = require('axios');
      var data = JSON.stringify({"exchange":"NSE","symboltoken":"2885",
      "interval":"FIVE_MINUTE","fromdate":"2021-11-08 09:00",
      "todate":"2021-11-08 09:20"});

      var config = {
      method: 'post',
      url: 'https://apiconnect.angelbroking.com/rest/secure/angelbroking/historical/v1/getCandleData',
      headers: {
      'X-PrivateKey': 'XXXXXXXX',
      'Accept': 'application/json, application/json',
      'X-SourceID': 'WEB, WEB',
      'X-ClientLocalIP': 'CLIENT_LOCAL_IP',
      'X-ClientPublicIP': 'CLIENT_PUBLIC_IP',
      'X-MACAddress': 'MAC_ADDRESS',
      'X-UserType': 'USER',
      'Authorization': 'Bearer XXXXXXXXX',
      'Content-Type': 'application/json'
      },
      data : data
      };

      axios(config)
      .then(function (response) {
      console.log(JSON.stringify(response.data));
      })
      .catch(function (error) {
      console.log(error);
      });

      Could you kindly let me know where I am going wrong

      A 1 Reply Last reply Reply Quote 0
      • A
        admin @RK last edited by

        HI @RK Kinldy connect us at api@anglebroking.com as it is hard to debug looking at your code.

        R 1 Reply Last reply Reply Quote 0
        • R
          RK @admin last edited by

          @admin

          I have emailed the respective EMAILID that you have provided but I did not get a response.

          Can you kindly check.

          Thanks,
          Akey Venkat

          R 1 Reply Last reply Reply Quote 0
          • R
            RK @RK last edited by

            @admin

            I am able to access the data. I was sending the headers wrong. The X_SOURCEID and Accept parameters were send twice per say:
            'X-SourceID': 'WEB, WEB' has to be 'X-SourceID': 'WEB'

            Thank You very Much.
            Much appreciated.

            1 Reply Last reply Reply Quote 0
            • First post
              Last post