Dec. 8th, 2015

madbernard: a long angled pier (Default)
You probably know that when you have a URL like this, https://frontendmasters.com/hi/courses/crash-course?utm_source=bsa&utm_medium=ppc&utm_term=2015-12&utm_content=why-not-xmas&utm_campaign=crash-course, the weird mangled bit is not necessary for loading the page. I just learned why that is: the ? in the URL signifies that that's where the URL is starting to pass along info to receiving programs, and the info references something set up on the receiving end. And there's more to learn from the structure:
https://frontendmasters.com/hi/courses/crash-course?
utm_source=bsa&
utm_medium=ppc&
utm_term=2015-12&
utm_content=why-not-xmas&
utm_campaign=crash-course
those '&' are joining different references. The stuff before the equals sign references already-built containers to catch the possibly-varying info that is to the right of the equals sign. This is what I saw when rolling my own:

The guy I was paired with and I were having a time of it, figuring out how to tell a Parse server (https://parse.com/docs/rest/guide#queries-query-constraints) how to sort and shape the data we wanted it to return to us. It turns out that we could do it by sending our request to a URL different than the usual URL, which was https://api.parse.com/1/classes/. We instead sent a GET request (the normal "bring me a website, please") request to https://api.parse.com/1/classes/?order=-createdAt&limit=1000. Parse's documentation points out that it will accept parameters like "order" and "limit" and those take values like "field to sort by" and "number up to 1000", so with this URL we're telling Parse that we wanted the 1000 most recently created things... And it worked.

That was pretty great! It turns out that we were supposed to be using jQuery to make things tidier, though, so in the end we went with http://api.jquery.com/jquery.ajax/, filling the data: part of that with "data: {'order':'-createdAt', 'limit':'1000'},".

November 2022

S M T W T F S
  12345
6789101112
1314 1516171819
20212223242526
27282930   

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Jun. 8th, 2025 04:44 pm
Powered by Dreamwidth Studios