• Resolved thawek

    (@thawek)


    Hi,

    Trying to parse JSON as here:

    [jsoncontentimporter url=https://api.autorouter.aero/v1.0/notam?itemas=["EPKM"] numberofdisplayeditems=-1 urlgettimeout=5 debugmode=10 ]Ilo?? znalezionych NOTAMów: {total}
    <ol>
    {subloop-array:rows:-1}
     	<li>{iteme} (VALID: FM {startvalidity} TO {endvalidity})</li>
    {/subloop-array:rows}
    </ol>
    [/jsoncontentimporter]

    and that is the result:
    Sample Page – suprisingly parsing
    Main Page – not parsing at all.

    • This topic was modified 3 years, 8 months ago by thawek.
    • This topic was modified 3 years, 8 months ago by thawek.

    The page I need help with: [log in to see the link]

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter thawek

    (@thawek)

    I think the issue is with the URL:
    https://api.autorouter.aero/v1.0/notam?itemas=[%22EPKM%22] <- This downloads entire HTML, and parser can’t handle it;
    https://api.autorouter.aero/v1.0/notam?itemas=["EPKM"] <- gives “No URL Defined: Check the shortcode […]”

    • This reply was modified 3 years, 8 months ago by thawek.
    Plugin Author berkux

    (@berkux)

    Hi,

    Replace the [ and ] by %5B and %5D and use

    https://api.autorouter.aero/v1.0/notam?itemas=%5B%22EPKM%22%5D

    These are the urlencoded [ and ]
    The Api server should understand this and wordpress does not get confused where the shortcode ends.

    Bernhard

    Thread Starter thawek

    (@thawek)

    Hi berkux,

    %5B / %5D works, when the plugin is on separated page, but unfortunately doesn’t work on main page, when shortcode is put into text editor of Elementor.

    Plugin Author berkux

    (@berkux)

    Hi,

    I tried it with elementor (the elementor-shortcode-widget!) and it was ok with this:

    [jsoncontentimporter url=https://api.autorouter.aero/v1.0/notam?itemas=%5B%22EPKM%22%5D]Ilo?? znalezionych NOTAMów: {total}
    <ol>
    {subloop-array:rows:-1}
     	<li>{iteme} (VALID: FM {startvalidity} TO {endvalidity})</li>
    {/subloop-array:rows}
    </ol>
    [/jsoncontentimporter]

    Bernhard

    Thread Starter thawek

    (@thawek)

    Dear Berkux,

    Works like a charm, perfect!

    Now I just need to get how to convert {startvalidity} and {endvalidity} from epoch to humanlike date/time. Probably some JS, but I don’t have idea yet, how to do that.

    Thanks anyways!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘not valid JSON from HTTP GET’ is closed to new replies.