Microsoft Graph OneDrive webUrl property not consistent - microsoft-graph-api

The webUrl property of an Onedrive item differs on if the file can be opened Online or not.
As an example when I call /v1.0/me/drive/root/children I get items with
https://domain-my.sharepoint.com/personal/user/_layouts/WopiFrame.aspx?source={{id}}&file={{filename}}
https://domain-my.sharepoint.com/personal/Documents/Folder/filename.txt
Why not using a consistent url here, as the Online Apps will also work with the second Url?
The second url can also be used by the client apps to open the document while the first url can't.
It's also hard to construct the second version of the link from the other item properties while the first link can be easily constructed.

The purpose of the webUrl is to provide a URL that displays the resource in the browser. In the cases where a specialized experience can be provided (such as coediting office files in the web app) we'll return URLs specific to those scenarios, otherwise we'll return a generic URL and expect the browser to "do the right thing".
It is possible to always get URLs of the form of 2. by selecting the webDavUrl property when requesting the item.
See this documentation for descriptions of these fields.

Related

Does twitter stream API allow filtering by urls?

I am trying to do a filter by urls but no result is being returned.
From the following doc, it shows it is possible https://developer.twitter.com/en/docs/tweets/rules-and-filtering/overview/premium-operators
but I think it's a premium feature. Is this true? If yes then is there any other way to filter by urls without using the premium feature?
Standard Twitter streaming API provide us with 'track' parameter. This is a Standard streaming API parameter (see the doc). It matches Tweets as by phrases as by URLs. A common use case according to the doc:
a common use case where you may want to track all mentions of a particular domain name (i.e., regardless of subdomain or path), you should use “example com” as the track parameter for “example.com”
This parameter value Will match...:
example.comwww.example.com foo.example.com foo.example.com/bar I hope my startup isn’t merely another example of a dot com boom!
I tested the option by means of twitter-hbc library for Java. It works as expected!
To avoid confusion, please, take the note:
The text of the Tweet and some entity fields are considered for matches. Specifically, the text attribute of the Tweet, expanded_url and display_url for links and media, text for hashtags, and screen_name for user mentions are checked for matches.

Patterns between YouTube m. and normal site urls

My site is not able to show uploaded youtube videos when the url is a mobile (m.) site, but it works for the normal youtube site. It seems to me that the mobile and normal urls differ in a pattern, as shown below:
http://www.youtube.com/watch?v=5ILbPFSc4_4
http://m.youtube.com/#/watch?v=5ILbPFSc4_4&desktop_uri=%2Fwatch%3Fv%3D5ILbPFSc4_4
obviously, the m. is added, as is the /#, and all the &desktop_uri... stuff.
and again:
http://www.youtube.com/watch?v=8To-6VIJZRE
http://m.youtube.com/#/watch?v=9To-6VIJZRE&desktop_uri=%2Fwatch%3Fv%3D8To-6VIJZRE
What we hope to do is check to see if the url is mobile site, and if it is, parse it so it shows as the normal site.
Does any one know if all youtube urls work this way--if this similar pattern works for all the same videos on mobile and normal sites?
In general, any time you attempt to parse URLs for sites (as opposed to web APIs) by hand, you're leaving yourself open to breakage. There's no "contract" in place that states that a common format will always be used for watch page URLs on the mobile site, or on the desktop site.
The oEmbed service is what you should use whenever you want to take a YouTube watch page URL as input and get information about the underlying video resource as output in a programmatic fashion. That being said, the oEmbed response doesn't include a canonical link to the desktop YouTube watch page, so it's not going to give you exactly what you want in this case. For many use cases, such as when you want to get the embed code for a video given its watch page URL, it's the right choice.
If you do code something by hand, please ensure that your code is deployed somewhere where it would be easy to update if the format of the watch pages ever do change.

what IS the og:url metatag?

I am building an iOS app that is supposed to use openGraph objects for users.
As I see it, I need to :
1. create object pages for each of these objects that contains all the metatags that facebook is generating for your created objects in Get Code.
2. Use the iOS app to generate opengraph requests that involve these objects through a single page. ie. a PHP file that uses parameters you might send to it, that would generate links to images and some titles etc... (am I right?)
The thing is that the PHP file on step 2 is supposed to be the object itself, and my object needs a og:url which is either interpreted as a type:wesite, which is wrong because my type is set to my own custom type! or it just throws an error saying that the og:url is not valid.
I can see that facebook is scraping whatever I give it in the og:url, so basically why is this needed in the first place if all metatags are ignored?
You seem to have this correct, basically, to publish an action against an object using the Open Graph APIs, there needs to be an object URL which, when accessed, does one of the following
Contains the complete set of metadata needed to describe whatever type of object you're created and serves this to Facebook's crawler
Contains an og:url meta tag, a <link ref="canonical tag or a HTTP 301 redirect pointing to a URL which does 1)
Having a PHP script which takes input parameters and returns metadata based on those is a common approach, the biggest thing to watch out for is that your og:url tag matches the input parameters, so Facebook's crawler doesn't make a new request out to that URL instead of the one it asked for originally
og:url means: Open Graph Uniform resource locator.
https://developers.facebook.com/docs/opengraph/tutorial/

Hide website filenames in URL

I would like to hide the webpage name in the url and only display either the domain name or parts of it.
For example:
I have a website called "MyWebSite". The url is: localhost:8080/mywebsite/welcome.xhtml. I would like to display only the "localhost:8080/mywebsite/".
However if the page is at, for example, localhost:8080/mywebsite/restricted/restricted.xhtml then I would like to display localhost:8080/mywebsite/restricted/.
I believe this can be done in the web.xml file.
I believe that you want URL rewriting. Check out this link: http://en.wikipedia.org/wiki/Rewrite_engine - there are many approaches to URL rewriting, you need to decide what is appropriate for you. Some of the approaches do make use of the web.config file.
You can do this in several ways. The one I see most is to have a "front door" called a rewrite engine that parses the URL dynamically to internally redirect the request, without exposing details about how that might happen as you would see if you used simple query strings, etc. This allows the URL you specify to be digested into a request for a master page with specific content, instead of just looking up a physical page at that location to serve.
The StackExchange sites do this so that you can link to a question in a semi-permanent fashion (and thus can use search engines with crawlers that log these URLs) without them having to have a real page in the file system for every question that's ever been asked (we're up to 9,387,788 questions as of this one).

Is there a way to find all the pages' link by a URL?

If I have a link say http://yahoo.com/ so can I get the links inside yahoo? For example, I have a website http://umair.com/ and I know there are just 5 pages Home, About, Portfolio, FAQ, Contact so can I get links as follows programmatically?
http://umair.com/index.html
http://umair.com/about.html
http://umair.com/portfolio.html
http://umair.com/faq.html
http://umair.com/contact.html
Define what you mean by "links inside yahoo".
Do you mean all pages for which there is a link to on the page returned by "http://www.yahoo.com"? If so, you could read the HTML returned by an HTTP GET request, and parse through it looking for <a> elements. You could use the "HTML Agility Pack" for help.
If you mean, "All pages on the server at that domain", probably not. Most websites define a default page which you get when you don't explicitly request one. (for example, requesting http://umair.com almost certainly returns http://umair.com/index.html). Very few website don't define a default, and they will return a list of files.
If you mean, "All pages on the server at that domain, even if they define a default page", no that cannot be done. It would be an extreme breach of security.
This could be done by a Web Crawler, read some basic information about it:
http://en.wikipedia.org/wiki/Web_crawler
Includes Open Source crawlers, see if any of them is what you are looking for.

Resources