Paw support for REST Level 3 (HATEOAS) Navigation? Following links - paw-app

I'm using Paw as a client to a REST Level 3 (HATEOS) API. As part of REST Level 3 links to related resources are discoverable as part of the response returned. Does Paw provide any REST Level 3 specific support such as making it easy to follow the links returned?
What I would really like to be able to follow those links by clicking (Command+clicking if needed) on the value URL in the response and it issue a GET against that URL. I would also like any HTTP headers to be carried over to the URL so things such as authorization would not break.
(It may or may not want to be smart and only do this if it's the same domain/context-root the original request so likely to be a REST Level 3 link and not any generic link).
See example of what would be great to be clickable below:
Ideally it would also be great to be able to navigate back to previous responses once the result has been followed. A lot of REST Level 3 links provide back or 'rev' links to allow this, but not all links are bi-directional so being able to go back like in a browser would be great.
Currently my workaround is:
Triple-clicking on the value
Command+C
Navigate to address bar
Command+A
Command+V
Command+Enter
So it's doable today, but 6 actions rather than a single click action on a URL contained in the response is tedious when repeated a lot of times. Also to navigate back to a previous response when there isn't a 'rev' link is a frustrating experience.
Many thanks in advance.

Related

Facebook shares not using og:url when clicked in Facebook?

One of the purposes of og:url -- I thought -- was that it was a way you could make sure sessions variables, or any other personal information that might find its way into a URL, would not be passed along by sharing in places like Facebook. According to the best practices on Facebook's developer pages: "URL
A URL with no session id or extraneous parameters. All shares on Facebook will use this as the identifying URL for this article."
(under good examples: developers.facebook.com/docs/sharing/best-practices)
This does NOT appear to be working, and I am puzzled as to either -- how I misunderstood, and/or what I have wrong in my code. Here's an example:
https://vault.sierraclub.org/fb/test.html?name=adrian
When I drop things into the debugger, it seems to be working fine...
https://developers.facebook.com/tools/debug/sharing/?q=https%3A%2F%2Fvault.sierraclub.org%2Ffb%2Ftest.html%3Fname%3Dadrian
og:url reads as expected (without name=adrian).
But if I share this on facebook -- and then click the link. The URL goes to the one with name=adrian in it, not the og:url.
Am I doing something incorrectly here, or have I misunderstood? If the latter, how does one keep things like sessions variables out of shares?
Thanks for any insight.
UPDATE
Facebook replied to a bug report on this, and I learned that I indeed was reading the documentation incorrectly
developers.facebook.com/bugs/178234669405574/
The question then remains -- is there any other method to keeping sessions variables/authentication tokens out of shares?

About google adwords conversions

So I'm stuck with problem: I have created conversion and added snippet inside body tag. Problem is:
I don't quite understand, in my developer console, in section
"Network" I see a conversion request, but there are 4 of them and
only one is 200 OK, others are 302. Is this normal?
Regarding click conversions. I have some kind of contact form (not
plugin), it does ajax request to my server (sending contact form
data). And in $.ajax's "success" section I added call of conversion
click function. It does same as page load conversion: makes 4
request, 3 are 302, 1 is 200.
Is it normal? If not, how can I fix it?
You could use the Tag Assistant chrome extension to debug tags, it has its flaws but can usually be trusted.
But in general:
Yes, perfectly normal. What is actually happening here is that Google uses the 302 to log the actual conversion, but then redirects you to serve the pixel (or script) to save bandwidth.
Same thing. But you might want to setup a different conversion label here, so you can track both conversions separately.
You might also benefit from using Google Analytics, which will give you a bunch more data about user behavior and help debug tag problems.

Webscraping a tricky asp.net page

The overall goal is to perform a search on the following webpage http://www.cma-cgm.com/eBusiness/Tracking/Default.aspx with a container value of CMAU1173561. I have tried two approaches, the php extension cURL and python's mechanized. The php approached involves a performing a POST submit using the input fields found on the page (NOTE: These are really ugly on the asp.net page). The returned page does not contain any of the search results. The second approaches involves using python's mechanize module. In this approach I load the page, select the form, then change the text field ctl00$ContentPlaceBody$TextSearch to the container value. When I load the response again no search results.
I am at a really dead end. Any help would be appreciate because as it stands my next step is to become a asp.net expertm which i perfer not to.
The source of that page is pretty scary (giant viewstate, tables all over the place, inline CSS, styles that look like they were copied from Word).
Regardless...an ASP.Net form still passes the same raw data to the server as any other form (though it is abstracted to the developer).
It's very possible that you are missing the cookies which go along with the request. If the search page (or any piece of the site) uses session state, the ASP.Net session cookie must be included in the request. You will be able to tell it from its name (contains "asp.net" and "session").
I assume that you have used a tool like Firebug or Chrome to view the complete outgoing request when the page is submitted. From my quick test, it looks like the request may be performed with a GET, not a POST. I submitted a form, looked at the request, and pasted the URL into a new browser window.
Example: http://www.cma-cgm.com/eBusiness/Tracking/Default.aspx?ContNum=CMAU1173561&T=57201202648
This may be all you need to do.

Abusing HTTP POST

Currently reading Bloch's Effective Java (2nd Edition) and he makes a point to state, in bold, that overusing POSTs in web applications is inherently bad. Unfortunately, he doesn't specify why.
This startled me, because when I do any web development, all I ever use are POSTs! I have always steered clear of GETs for security reasons and because it felt more professional (long, unsightly URLs always bother me for some reason).
Are there performance differentials between GET and POST? Can anyone elaborate on why overusing POSTs is bad, and why? My understanding - and preliminary searches - seem to all indicate that these two are handles very similarly by the web server. Thanks in advance!
You should use HTTP as it's supposed to be used.
GET should be used for idempotent, read queries (i.e. view an item, search for a product, etc.).
POST should be used for create, delete or update requests (i.e. delete an item, update a profile, etc.)
GET allows refreshing the page, bookmark it, send the URL to someone. POST doesn't allow that. A useful pattern is post/redirect/get (AKA redirect after post).
Note that, except for long search forms, GET URLs should be short. They should usually look like http://www.foo.com/app/product/view?productId=1245, or even http://www.foo.com/app/product/view/1245
You should almost always use GET when requesting content. Only use POST when you are either:
Transmitting sensitive information which should not appear in the URL bar, or
Changing the state on the server (adding/changing/deleting stuff, altough recently some web applications use POST to change, PUT to add and DELETE to delete.)
Here's the difference: If you want to give the link to the page to a friend, or save it somewhere, or even only add it to your bookmarks, you need the full URL of the page. Just like your address bar should say http://stackoverflow.com/questions/7810876/abusing-http-post at the moment. You can Ctrl-C that. You can save that. Enter that link again, you're back at this page.
Now when you use any action other than GET, there is simply no URL to copy. It's like your browser would say you are at http://stackoverflow.com/question. You can't copy that. You can't bookmark that. Besides, if you would try to reload this page, your browser would ask you whether you want to send the data again, which is rather confusing for the non-tech-savy users of your page. And annoying for the entire rest.
However, you should use POST/PUT when transferring data. URL's can only be so long. You can't transmit an entire blog post in an URL. Also, if you reload such a page, You'll almost certainly double-post, because the above described message does not appear.
GET and POST are very different. Choose the right one for the job.
If you are using POST for security reasons, I might drop a mention of other security factors here. You need to ensure that you send the data from a form submit in encrypted form even if you are using POST.
As for the difference between GET and POST, it is as simple as GET is used to send a GET request. So, you would want to get data from a page and act upon it and that is the end of everything.
POST on the other hand, is used to POST data to the application. I am talking about transactions here (complete create, update or delete operations).
If you have a sensitive application that takes, say and ID to delete a user. You would not want to use GET for it because in that case, a witty user may raise mayhem simply changing the ID at the end of the URL and deleting all random uses.
POST allows more data and can be hacked to send streams of files as well. GET has a limited size though.
There is hardly any tradeoff in using GET or POST.

Issue with IHttpHandler and relative URLs

I've developed a IHttpHandler class and I've configured it as verb="*" path="*", so I'm handling all the request with it in an attempt of create my own REST implementation for a test web site that generates the html dynamically.
So, when a request for a .css file arrives, I've to do something like context.Response.WriteFile(Server.MapPath(url)) ... same for pictures and so on, I have to response everything myself.
My main issue, is when I put relative URLs in the anchors; for example, I have main page with a link like this Go to Page 1 , and in Page 1 I have another link Go to Page 2. Page 1 and 2 are supposed to be at the same level (http://host/page1 and http://host/page2, but when I click in Go to Page 2, I got this url in the handler: ~/page1/~/page2 ... what is a pain, because I have to do an url = url.SubString(url.LastIndexOf('~')) for clean it, although I feel that there is nothing wrong and this behavior is totally normal.
Right now, I can cope with it, but I think that in the future this is gonna bring me some headache. I've tried to set all the links with absolute URLs using the information of context.Request.Url, but it's also a pain :D, so I'd like to know if there is a nicer way to do these kind of things.
Don't hesitate in giving me pretty obvious responses because I'm pretty new in web development and probably I'm skipping something basic about URLs, Http and so on.
Thanks in advance and kind regards.
First of all I would take a look at the output HTML delivered to the browser and specifically the links that you are describing.
You say that the link is Go to Page 2 but according to your result I would guess it is more like Go to Page 2.
You can confirm this by placing a brakepoint in the handler and when it triggers with "~/page1/~/page2" look in the address bar of your browser and it should say something like "http://www.example.com/page1/~/page2"
You should first look at the code generating the link. If it is generated from some kind of function call, make sure you get the web address and not the script address.
In any case these kind of links that switch between first level pages should all start with a "/" indicating that their location is relative to the root of your website rather than relative to the current shown page.

Resources