How to lookup all sites with the Microsoft Graph API - sharepoint

I am looking for a Graph API call which can return to me all of the sites in Sharepoint Online.
Looking at Enumerating Sites:
https://learn.microsoft.com/en-us/graph/api/site-list?view=graph-rest-beta&tabs=http
GET https://graph.microsoft.com/beta/sites?filter=siteCollection/root ne null
it doesn't seem to return group-based sites or sub sites.
Looking at Site Search:
https://learn.microsoft.com/en-us/graph/api/site-search?view=graph-rest-beta&tabs=http
GET https://graph.microsoft.com/beta/sites?search={query}
this might be more promising but there is no explanation for how "query" should be structured or what it searches against.
My thought was that since all of the site ids begin with the tenant domain that I might be able to search on that and then retrieve every site and subsite for the tenant. But I'm not sure how to perform that query.
Ideally something like:
GET https://graph.microsoft.com/beta/sites?search=id like contoso.microsoft.com

I found this post asking a very similar question.
https://sharepoint.stackexchange.com/questions/230187/retrieve-all-sites-and-all-subsites-from-the-sharepoint-rest-api
And there is a response by 'dvdsmpsn' where he shares that you can retrieve all sites with this call:
https://graph.microsoft.com/v1.0/sites?search=*
Interestingly this doesn't work in the beta version of the graph API (at this time).
This achieves what I wanted so I'm posting this as an answer, but it doesn't quite answer the question of how a search should be formatted so I'll leave this question open for somebody else to answer if they can.

Related

SharePoint Graph API - There is no update page endpoint - looking for suggestions on best way to do this

I am currently working with The SharePoint Graph API.
This is the scenario I need to achieve:
Somehow call page by name not ID
If page called my_page_name.aspx exists
update it
else
create the page
As far as I can work out, there is no update page end point in the documentation here:
https://learn.microsoft.com/en-us/graph/api/resources/search-api-overview?view=graph-rest-beta
The only thing I can think of to do it the following:
Call the page by name
delete it
create a new page with the same name with the new content I want to update
Any help on how I achieve what I need would be great
Yes, As of now we don't have any 'Update Page' endpoint feature and there is already a uservoice for this here. Please upvote this uservoice so that this feature could be developed in future. And also remember that since the pages endpoint is in beta these are subjected to change and its not recommended to use for production purpose.

Nodejs URL modifications for SEO purposes

I have a working App built on Nodejs + Drywall + Openshift, sorry it's in Arabic. Basically, I am looking to improve on the service, but having a major roadblock. The site is a classifieds site and I need to optimize it for SEO, however, my links to ads are shown like this...
http://yobyobi.com/ads/show/55c9ff9dcf68970612ba2d38
55c9ff9dcf68970612ba2d38 is the Ad ID on my mongoDB, I do also have a record for the indicating the date and the title of Add combined "Sun-Nov-22-2015-8-pm-2007-camry-for-sale", the goal is to make the URL pretty and understandable by search engines. The end result I want to accomplish is one of the following:
yobyobi.com/ads/show/55c9ff9dcf68970612ba2d38/Sun-Nov-22-2015-8-pm-2007-camry-for-sale
yobyobi.com/ads/show/Sun-Nov-22-2015-8-pm-2007-camry-for-sale/55c9ff9dcf68970612ba2d38
yobyobi.com/ads/show/Sun-Nov-22-2015-8-pm-2007-camry-for-sale/
Now, option number 3 would be ideal, but would slow down my application if I have to search by Ad title instead of Ad ID. Similar to what Stackoverflow is doing (attached pic)
Stackoverflow example
Code
app.get('/ads/show/:id', require('./views/account/ads/index').read);
The above line returns the Ad for me with all the details including the title that I want to use, but the problem is that I cannot change the route URL after I receive the title.
I am not sure if this module would help in whatever I am trying to do it's called "named-routes"
Has anyone ran across this problem? If so can you share some insight on how to best tackle the problem?
Thanks in advance,
well, the solution was dead simple, do the following:
add * as a wild card like this
app.get('/ads/show/:id/*', require('./views/account/ads/index').read);
now when you create the links to the post, attach anything where the * is and it should show the same Ad without breaking the page.
Cheers

How can I search Instagram with hashtags via a URL?

On both Facebook and Twitter, you can do a simple search of hashtags on these channels via a URL search, for example,
https://www.facebook.com/hashtag/myhashtag
Can you do the same with Instagram also? I can't seem to figure it out. I did find some API, but that's about all: https://instagram.com/developer/endpoints/tags/
This might be something that Instagram implemented after this question was originally asked, but this currently works:
http://instagram.com/explore/tags/yourhashtag
OR
http://instagram.com/tags/yourhashtag
The latter simply redirects to the former, but it's handy to have a shorter URL in some instances.
You'll find out more about how to customise Instagrams URLs by using endpoints on their API documentation page.
I'm not very familiar with how to use URL parameters and I'd be curious to know if anyone has found a way to filter via URL both by user and hashtag. Meaning that you show everything a specific user has posted with a specific hashtag. Many Instagram plugins allow you to do this at the same time, so one would hope it's possible via URL as well.
There is the instagram public API's tags section that can help you do
this. http://instagram.com/developer/endpoints/tags/
http://iconosquare.com/tag/ is another alternative
For example: http://iconosquare.com/tag/flowers
via https://stackoverflow.com/a/11182218/1085891

Foursquare venues search and TOS

I'm using another venues provider, but would like to search Foursquare from the venue results of that provider for Foursquare checkins. Is this possible or would that be considered violating the TOS?
Why not read the Policy at https://developer.foursquare.com/overview/community ?
Whats written there as of writing this answer is that it is okay to extend their results with other data sources.
It is not okay to search across both foursquare and Google Places, then return a combination of their results/data.
What I would do if I am doing something I am not sure of is just ask them directly at https://developer.foursquare.com/overview/support
At the last paragraph they talk about policy (at the support page), says you can email them directly.

graph api search not returning a post

I am searching using https://graph.facebook.com/search?q=anglogold&type=post
this is not returning a post I made myself just now. Any idea why
https://graph.facebook.com/search?q=anglogold&type=post
returns a lot of posts for me.
Facebook can restrict results on search api on different scenarios.
Not suitable for a particular country/region
Not a public post
Person is blocked by user
and may be few others.

Resources