none
Query From Web API whose URL changes slightly every 3 months RRS feed

  • Question

  • Hi all,

    I have a series of queries where the first step of the query is to pull JSON from a web API.  All of my queries are set up and work properly except for one problem:

    Every 3 months a portion of the URL is changed.  For example, 3 months ago the URL I was using to pull information was:

    http://poe.ninja/api/Data/GetCurrencyOverview?league=Synthesis

    And recently it has changed to:

    http://poe.ninja/api/Data/GetCurrencyOverview?league=Legion

    There are a number of URLs that are similar, such as:

    https://poe.ninja/api/Data/GetUniqueJewelOverview?league=Legion

    https://poe.ninja/api/Data/GetUniqueArmourOverview?league=Legion

    etc.

    In every case, the only thing that changes is the last word (the league). Because only the league changes, the only thing I need is an easy way to change the league for all of the different URLs I have (about 50).

    Currently I manually update these URLs every 3 months, but I am wondering if there is a way to create a variable in the URL strings.  Then, I would only need to change the variable every 3 months, and not everything else.

    Also, I am using Power Query in Excel.  I think I'm in the right place but please let me know if I am not and I will re-post.

    Thanks for any help.


    • Edited by gdneye Thursday, July 25, 2019 2:16 AM
    Thursday, July 25, 2019 2:15 AM

Answers

  • Hi there. Yes, you can definitely make this process easier by using parameters. Just create a parameter and concatenate it to the end of your URLs (you can do this directly in M via the formula bar, or edit each Source step and click over to the Advanced section of the dialog to do it via UI).

    Ehren

    Friday, July 26, 2019 11:09 PM
    Owner