Import of JSON from URL fails

New home Forums Pro Add-on Troubleshooting Import of JSON from URL fails

Tagged: 

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #73097
    codegeek
    Participant

    I am attempting to import map data from an api endpoint that generates a json response. If I visit the url and save the response, I can import the json as file just fine.

    If I attempt to import directly from the api via the url, I get “Unable to import file.”

    The url which generates the json is https://wyolottodev.wpengine.com/wp-json/map/v1/winners/all/5000/2000

    I’ve attached the resulting json file to this message – this imports just fine. But not when fetched from a url.

    Does json fetched from a url require a different structure from json uploaded via a file? If so, what is that structure?

    Thanks!
    Kevin

    • This topic was modified 2 weeks ago by codegeek.
    Attachments:
    You must be logged in to view attached files.
    #73101
    Matthew
    Moderator

    Hi Kevin,

    Thank you for getting in touch with us, we do appreciate your time.

    We have found that you have also submitted a support ticket with us, thus we have responded to your ticket accordingly.

    Should you not have received our email response, please see my response below:

    Yes, the importer requires the JSON data to be in a specific format in order for the markers properties to be imported correctly. You may see our example JSON file from our documentation here: https://www.wpgmaps.com/wp-content/uploads/Example.json
    
    Link to Importing/Exporting documentation: https://www.wpgmaps.com/documentation/exporting-and-importing-your-markers/
    
    With regards to the URL you are using, the importer currently looks for a file, thus because your endpoint currently does not point to a file, it just outputs data, the importer will not be able to import the data as it is looking for a JSON file.
    ‚Äč
    With that said, I would recommend if possible for you to output your API endpoint's data to a JSON file saved in your site (wp-content/uploads) and then use the URL of that file in the importer.

    I hope this helps?

    Kindest Regards,
    Matthew

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.