Query using references to cell - json

I have a table with latitude and longitudes. I want to pull weather data from an API (openweathermap.org) using the coordinates from my table. Any help would be appreciated. I don't have much experience with queries.
let
Source = Json.Document(Web.Contents("api.openweathermap.org/data/2.5/weather?lat=49.57&lon=-121.79&appid=xxxxx"))
in
Source

Your API call should contain "https://" in the web address like so:
https://api.openweathermap.org/data/2.5/weather?lat=49.57&lon=-121.79&appid=xxxxx
Also you might already be aware, but it also goes without saying you need to replace XXXXX with your actual appid

Related

What is the URL when I DELETE an object

I'm running a local server playing around with an API using Django. I have a model called 'Users' populated with a few objects, and am using DefaultRouter.
I want to know what the URL would be if I were to DELETE a specific object from this model. For example, if I wanted to GET a user with an ID of 1 in this model, the URL would be: "localhost:8000/Users/1/". What would the equivalent be to DELETE this user?
I found an explanation of this on the REST API website (below), however, I don't understand what any of the syntaxes means.
What is {prefix}, {url_path}, {lookup} and [.format]? If anyone could provide an example of what this might be using a localhost that would be really helpful.
Thanks
Let us take an example of an API (URL) to update book data with id (pk) being 10. It would look something like this:
URL: http://www.example.com/api/v1/book/10/
Method: PUT/PATCH
With some data associated.
If you want to delete you just need to change method to DELETE instead of put or patch.
Regarding your second question lets compare the url with the parameters.
prefix: http://www.example.com/api/v1/book
lookup: 10
format: It specifies what type of data do you expect when you hit the API. Generally it is considered to be json.
url_path: In general, every thing after look up except query string is considered to be url_path.

OSM to CSV with OSMCONVERT gives my "empty" amenities

I'm trying to convert my country's Open Street Map data to a CSV file which I can then load in tableau and map businesses.
I downloaded osmconvert, which seems to be the default tool for this process.
Then I downloaded the Dominican Republic's data from this URL:
http://download.geofabrik.de/central-america/haiti-and-domrep.html
When I run the following command:
osmconvert64.exe data.osm --csv="#id #lon #lat #amenity #name #shop" --csv-headline --csv-separator=, -o=outfile.csv
I get a sheet like this:
Picture of excel sheet with empty columns
I seem to get the ID, Latitude and Longitude data right, but get empty amenity, name, and shop columns.
Am I writing the command wrong? I'd appreciate any help, since I can't seem to find an user-friendly tutorial on using this tool on the internet.
I'm not very familiar with osmconvert but as far as I know it will generate an entry for each element in the input file. Most elements from the input file won't have a amenity, name or shop tag. That's why you get so many empty columns. I guess you have to specify an additional filter to get only elements with an amenity or shop tag, possibly with the help of osmfilter.
Alternatively just use Overpass API and perform a simple query for all elements with an amenity or shop tag. Overpass API is also able to generate CSV output.

How to Retrieve Large URL Json Data Set?

I am trying to obtain a data set via json and url, using SODA's API. The issue is that the data set is greater then 50K, and I need to sort the data set using multiple keys. Sorting by multiple keys is not something that is permitted by SODA's API. The question is how could I get around that?
Example (This table is small, but for illustrative purposes I have included it):
https://data.medicare.gov/resource/apyc-v239.json?$Limit=1000&$Order=measure_id
but once I attempt to add state to the order the API errors out.
The data set above is only 3800 recs, however there are other datasets with over 250000 recs, which require the same approach - sorting, then paging through the results...
Any assistance would be greatly appreciated.
Try the new API endpoint for that dataset: http://dev.socrata.com/foundry/#/data.medicare.gov/apyc-v239
It'll allow you to sort by multiple columns and there's no maximum for $limit on the new endpoints, so you can do stuff like this:
https://data.medicare.gov/resource/q7p2-jxeh.json?$order=state,measure_name&$limit=100000000

How can I change the domain of a URL within a varchar column?

I have a database structure where one of my columns (innerLink) has a URL within it.
So that innerLink column will have a URL structured as follows
http://www.123456.com/forums/showthread.php?t=123456
I wanted to change the http://www.123456.com to a wholly different URL --> http://789.123.com without affecting the rest of the URL structure (ie. /forums/showthread.php?t=123456 )
I need this change to hit every URL in that column that is on the 123456 domain. I have other URLs such as cnn.com or msnbc.com so I dont want those affected. The change should only be to make www.123456.com to 789.123.com
I've never done this type of manipulation with MYSQL before, so was hoping for a bit of guidance before I hose my entire database of about 4000 records :) I will be doing this through PHPMYADMIN
Thanks for any help!!
You want to use the REPLACE() string function
UPDATE `table` SET `innerLink` = REPLACE('www.123456.com', '789.123.com');

Is it possible to combine a Google Spreadsheets JSON request with a data query?

I have successfully used the information in the link below to get a JSON output from a Google spreadsheet.
https://developers.google.com/gdata/samples/spreadsheet_sample
Is it possible to combine this JSON request with a data query, such as those seen in the link below this?
https://developers.google.com/chart/interactive/docs/querylanguage
Yes. Use the new url for accessing google docs:
https://docs.google.com/spreadsheets/d/%KEY%/gviz/tq?gid=%GID%&tq=%QUERY%
%KEY% and %GID% can be found in your spreadsheet's url, and %QUERY% is whatever you are asking the sheet for. For example, you might ask it to look up a phone number in column B by looking for a name in column A by passing "B where A = 'John Smith'" as the %QUERY%.
seems like it doesn't need the GID parameter :D