CSV Import from URL is recognized as JSON

New home Forums Pro Add-on Troubleshooting CSV Import from URL is recognized as JSON

Tagged: , , ,

  • This topic has 6 replies, 3 voices, and was last updated 1 week ago by markt2001.
Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #73331
    Luca Di Fazio
    Participant

    Hello,
    I have a CSV which I would like to import from a URL with the following format:
    https://mydomain.com/path/to/the/file/markers.csv?signature=mysupersecret
    but it throws this error > …
    so it cannot recognize the CSV despite the url ending with “.csv”.
    If I remove the query string it works, but I need to secure my endpoint with a signature in the query string.
    How can I do it?
    Thanks,
    Luca

    • This topic was modified 1 year, 3 months ago by Matthew.
    • This topic was modified 1 year, 3 months ago by Matthew.
    #73338
    Matthew
    Moderator

    Hi Luca,

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

    Please may I ask if you would be open to providing me with the URL that you are attempting to import so that I may take a closer look?

    You may mark your reply as private should you like.

    I look forward to hearing back from you.

    Kindest Regards,
    Matthew

    #73346
    Luca Di Fazio
    Participant
    This reply has been marked as private.
    #73360
    Matthew
    Moderator

    Hi Luca,

    Thank you for your response regarding this, it is much appreciated.

    Thank you for the confirmation on the URL, unfortunately the Importer will automatically assume the file to be a JSON file if there are GET variables as we take the suffix of the URL to determine the file type – query variables are currently not accounted for and thus the importer will assume the file is of JSON type as it is the default type.

    We may look into adding the ability to select the file type to be imported for cases where the URL has query variables, however, it is currently not supported.

    In the meantime, you could upload your CSV file to your site and then use that custom location as your URL such as ‘https://example.com/wp-content/uploads/mycsv.csv’

    We do apologize for the inconvenience this may have caused.

    Kindest Regards,
    Matthew

    #73363
    Luca Di Fazio
    Participant
    This reply has been marked as private.
    #73564
    Matthew
    Moderator

    Hi Luca,

    Thank you for getting back to me and most valued time, I tremendously appreciate it!

    I am most happy to hear that, and it was my great pleasure assisting you with this.

    Please may you kindly consider reviewing our plugin at https://wordpress.org/support/plugin/wp-google-maps/reviews/#new-post?

    It would really mean the world to me! And if possible, please could I kindly ask you to mention both your name and mine in the review for administrative purposes as this would be a tremendous help?

    Should you ever require any further assistance, I am more than happy to help.

    Have a fantastic day further!

    Kindest Regards,
    Matthew

    #78472
    markt2001
    Member

    Hi,

    I was having the same issue as Luca and just wanted to post a workaround which is working for me, in case someone else is having the same problem:

    Just append a dummy GET param that ends in ‘.csv’ to the end of the URL.
    Eg: https://mydomain.com/path/to/the/file/markers.csv?signature=mysupersecret&filename=my_markers.csv

    In my case, the server doesn’t care about the extra ‘filename’ GET param so it just ignores it, and the maps plugin importer is happy, because the url ends in ‘.csv’.

    It would be nice in a future release though, if the importer looked at the response headers to determine if it’s json or csv (eg: ‘content-type: text/csv’ means a csv file).

    Thanks and regards,
    Mark

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