New home › Forums › Pro Add-on › Troubleshooting › CSV Import from URL is recognized as JSON
- This topic has 6 replies, 3 voices, and was last updated 1 week ago by markt2001.
-
AuthorPosts
-
June 15, 2022 at 9:48 am #73331Luca Di FazioParticipant
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.
June 15, 2022 at 9:51 am #73338MatthewModeratorHi 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,
MatthewJune 16, 2022 at 10:28 am #73346Luca Di FazioParticipantThis reply has been marked as private.June 17, 2022 at 4:11 pm #73360MatthewModeratorHi 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,
MatthewJune 17, 2022 at 5:55 pm #73363Luca Di FazioParticipantThis reply has been marked as private.June 20, 2022 at 10:41 am #73564MatthewModeratorHi 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,
MatthewSeptember 15, 2023 at 9:00 am #78472markt2001MemberHi,
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.csvIn 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 -
AuthorPosts
- You must be logged in to reply to this topic.