Skip to main content
All CollectionsReports
Use AGR's API to get data into PowerBI or Excel reports
Use AGR's API to get data into PowerBI or Excel reports
Updated over 6 months ago

Overview

The AGR Public API allows you to fetch forecast data and other calculations that AGR generates, enabling you to perform analysis using a BI tool of your choice.

This article covers how to get Forecast and Item data since they depend on each other.

Below is a step-by-step guide on connecting to your data feed using PowerBI, although it is applicable in Excel too.

  1. Open AGR and ask for an access token to the AGR Public API through the help chat.

  2. A Customer Success Manager will supply you with a very long jumble of characters. This is your API token.

  3. Open PowerBI, click Get Data and select Web:

    <a href="https://downloads.intercomcdn.com/i/o/949969185/ab8089dcaf7aa221261bdf08/image.png?expires=1734966000&amp;signature=97e71c0d96db452e598f14d31a9c2ef1cd5cb39d28097ecbab7194ebec75ea51&amp;req=fSQuH893nIlaFb4X1HO4gTsWi0t1RyUCuBUyxmF65JgzxcSAKGWax5cZl07V%0A" target="_blank" rel="nofollow noopener noreferrer">https://downloads.intercomcdn.com/i/o/949969185/ab8089dcaf7aa221261bdf08/image.png?expires=1717672500&amp;signature=da497f8aef9c2b8fe39486402b869c2bde03e2bbd78912b9923d0a93621f5790</a>

    We will start by getting the forecast values and then the Items.

  4. In the window that pops up, select Advanced.

    • Paste the following URL into the URL parts text box (https://api.agrinventory.net/api/Forecast/values/all/stream).

    • Write "Authorization" into the HTTP request header parameters text box.

    • Write "Bearer " into the text box to the right.

    • Finally, paste the API token you received in step 2 behind the Bearer keyword. Your window should look like this:

    <a href="https://downloads.intercomcdn.com/i/o/949979979/773088a4ed3331eeb7e1b325/image.png?expires=1734966000&amp;signature=59f57ed64941ed03f89040f62e2ad9fc0c8791e53912e0a5f6729ea533ab4552&amp;req=fSQuH853lIZWFb4X1HO4gSSt9TrLMt05Ksb%2BEGrUXD6SV7p2osgerXrqL8Ti%0A" target="_blank" rel="nofollow noopener noreferrer">https://downloads.intercomcdn.com/i/o/949979979/773088a4ed3331eeb7e1b325/image.png?expires=1717672500&amp;signature=786e2939469f0952decd90ce4765b9ec94ee1e62f4e4184311f996883a9ad24b</a>

    Note that it is important to have a space between the "Bearer" keyword and your API token!

  5. Press OK to get another modal. Select Anonymous in the top left and press Connect.

  6. A Power Query Editor window will open. You should see something like the image below:

    <a href="https://downloads.intercomcdn.com/i/o/949987744/903b87b56a0fafea8743e915/image.png?expires=1734966000&amp;signature=6eaa629e8f72fbac35286bdd321eb1caaa8eb19af044bf6b0ef185dd183569d9&amp;req=fSQuH8F5moVbFb4X1HO4gavwPl3hnrMZsedyWMyRxirQr3WlbXdSwoOW%2B9WE%0A" target="_blank" rel="nofollow noopener noreferrer">https://downloads.intercomcdn.com/i/o/949987744/903b87b56a0fafea8743e915/image.png?expires=1717672500&amp;signature=991449254b8e4839a70a66524d71e3fcaa78d990a87b00c2400d77b98f2fe141</a>

    For this example, we won't transform or modify the data. Click Close & Apply in the top left. You now have a data stream for forecast values generated by AGR.

  7. To get the Item list and supporting information, in the same PowerBI window, repeat steps 3. to 5. but put the following URL into the URL parts textbox (https://api.agrinventory.net/api/Item/stream).

  8. A Power Query Editor window will open. This one should look like the image below:

    <a href="https://downloads.intercomcdn.com/i/o/950000081/15e65bcca7b207f395d76fb9/image.png?expires=1734966000&amp;signature=7a486a8e5cdfee68cb4f6f310d647b385c0736dceb3d4a19e7f008d62ae686b8&amp;req=fSUnFsl%2BnYleFb4X1HO4gZtLDm6VWsWV8Gsnl2%2FaukhAeRJOg0k5oBZejncw%0A" target="_blank" rel="nofollow noopener noreferrer">https://downloads.intercomcdn.com/i/o/950000081/15e65bcca7b207f395d76fb9/image.png?expires=1717672500&amp;signature=cb0ad5f3ea0c5a06cbd63309013b23702bee14eeb417350350364f745f0c63ed</a>

    Now is a good time to rename the two queries we have set up to something more descriptive.

    In this example, we have renamed the Forecast and Items queries to ForecastValues and ItemInfo, respectively. When done, press Close & Apply in the top left.

  9. If you click on the Model View in the left sidebar, you can see a small model for the two previously created queries. PowerBI usually creates relationships automatically, so your model will look similar to the image below.

    <a href="https://downloads.intercomcdn.com/i/o/950004592/7892516f2688fe24ed192a41/image.png?expires=1734966000&amp;signature=8c3220f9d91d18af16a9119ea76a579663e6143faf3c1c45192710e86c4481af&amp;req=fSUnFsl6mIhdFb4X1HO4gXbCYRqRpRku61TpKw1Ue2Yk%2Be6IPgmiBIbnOJH0%0A" target="_blank" rel="nofollow noopener noreferrer">https://downloads.intercomcdn.com/i/o/950004592/7892516f2688fe24ed192a41/image.png?expires=1717672500&amp;signature=7671fb95d3305ee00357349055742627ec8f984d3776a7551fa9b688f914f868</a>

You should now have a functioning data set in PowerBI and can start analyzing!

Please note that the refresh schedule needs to be set to once per day.

Did this answer your question?