View
The view URL method is similar in behavior to the open method in that it allows users to link capture files directly to CloudShark from within webpage, emails, chats, etc…
There are two key differences however between the view URL call and the open URL call:
- The view URL call creates a brand new and unique decode session each time a user clicks on a link, whereas the open URL call redirects to a single decode session
- The view URL call does not utilize API tokens
Because the view URL call does not utilize API tokens, users will need to be logged into CloudShark when they click a view URL link unless guest-upload is enabled. The view URL call is most useful in situations where unique decode sessions are required and the primary concern is simply making existing capture file links readily viewable using CloudShark.
Usage
GET /view?url=<absolute-url of capture file>
Please note that because the most common usage is to embed links in existing HTML documents, that the url parameter must be properly encoded to avoid special characters and spaces. JavaScript provides a encodeURIComponent() method that works perfectly in this situation.
Examples
Supposing there is a capture file available at http://server/caps/myfile.pcap an existing link to the file could be changed to open it in CloudShark instead of being downloaded to the visitors computer.
Before:
<a href='http://server/caps/myfile.pcap'>Download myfile.pcap</a>
After:
<a href='https://www.cloudshark.org/view?url=http://server/caps/myfile.pcap'>Open myfile.pcap on CloudShark</a>
URLs with Authentication
The open method can be used with URLs with basic or digest authentication. These credentials can be embedded directly in the url parameter:
https://www.cloudshark.org/api/v1/<api-token>/open?url=http://username:password@server/caps/myfile.cap
Upon clicking this link a brand-new capture session will be created on the CloudShark appliance, and the web browser will redirect to view that new session. If the user is not logged in, they will be prompted to do so prior to the file being imported, unless guest-upload has been enabled. Instead of downloading myfile.pcap the browser will redirect to https://www.cloudshark.org/captures/.
If any errors prevent the URL from being imported, an error page will be displayed explaining what went wrong.