New Google Sites API - google-sites-2016

I know the current Google Sites API only supports Classic Sites.
Does this API exist now? and How to manage(create and etc) New Google Sites though API?

No, an API doesn't exist.
There are several feature requests in the issuetracker.google.com site, so they are aware it is needed. You would think they have some of the framework developed, since there is currently some access to sites (and I don't mean for editing) through the existing drive API. It would be worth adding your comments to those requests in the issue tracker website.
https://issuetracker.google.com/issues/36761330
https://issuetracker.google.com/issues/7324991
https://issuetracker.google.com/issues/120462223
https://issuetracker.google.com/issues/205856782

Though Google Sites API is still not available, I discovered some good news (for my use case, at least). I can confirm there are some minimal Google Sites abilities available through the Google Drive API. Specifically, I was able to add a user to the my site as viewer to a published site, using the Drive API permissions. Here is the Python code.
# get boilerplate creds= code from here https://developers.google.com/drive/api/quickstart/python
drive = build('drive', 'v3', credentials=creds)
new_permission = {
'type':'user',
'role':'reader',
'view':'published',
'emailAddress':USER_EMAIL
}
# you can get the SITE_FILEID from the site url
res = drive.permissions().create(fileId=SITE_FILEID, body=new_permission).execute()
Since the OP specifically asked about create, that works like so:
new_file = {
'name':'test site2',
'mimeType':'application/vnd.google-apps.site',
}
res = drive.files().create(body=new_file).execute()
Hope this can help some folks.

If you check Google sites api at the very top of the page it states.
If there was an api for accessing the new version they would have stated it. There is not.

According to this question, Google planned the new API for Google Sites for end of 2021: https://support.google.com/sites/thread/3363462/is-there-any-eta-for-the-new-google-sites-api?hl=en
I did not hear any news, since that.

Related

getKeywordStats() not working (Facebook API Java SDK )

I'm using the official Facebook API Java SDK to retrieve stats for each of the interests used in the targeting of a specific ad (as described in https://developers.facebook.com/docs/marketing-api/reference/ad-keyword-stats). When trying the call in Graph Explorer it works perfectly but I get an empty response in Java. I have already used the SDK to get insights for campaigns, ad sets and ads so the general setup is working. This is the code I have for now:
APINodeList<AdKeywordStats> stats = new Ad(adId, CONTEXT).getKeywordStats()
.requestAllFields().execute();
System.out.println(stats);
EDIT:
After some digging I think I found the cause of the problem, hopefully this PR should fix it: https://github.com/facebook/facebook-java-ads-sdk/pull/149

OneNote on SharePoint REST API

The OneNote team recently published a blog post in which they explain how to access data from OneNote notebooks that are stored on SharePoint ('site-hosted notebooks', as they refer to them).
I'm trying to use the API as they describe it, but I'm unable to get it to work. Specifically, the first step is to find out my site collections and site ID using the following API call:
https://www.onenote.com/api/beta/myorganization/siteCollections/FromUrl(url='{full-path-to-SharePoint-site}')
It seems to fail no matter what I do: I tried to put the full path to my SharePoint site with and without 'http://' or 'https://', tried to write my organization name in various ways (with '-my' at the end, and without it), and probably a few other combinations as well - it just doesn't work. I keep getting error 400 / bad request.
Any help would be greatly appreciated.
So ... I had a fairly long correspondence with the guys from Microsoft, and here's what I learned:
If you're using a browser or a browser plug-in to test some of your REST APIs calls, it's not enough to be logged-in as the relevant user. This works for SharePoint and other Office 365 APIs, but not for this OneNote API. You must send "Authorization: Bearer ... " in the request headers.
Probably my stupid mistake, but 'myorganization' in the URL https://www.onenote.com/api/beta/myorganization/siteCollections/FromUrl(url='{full-path-to-SharePoint-site}') is not the name of your organization / domain: it's the literal string 'myorganization'.
Finally, the 'full-path-to-sharepoint-site' should point to https://xyz.sharepoint.com and not to https://xyz-my.sharepoint.com.
This syntax works like a charm for me:
https://www.onenote.com/api/beta/myorganization/siteCollections/FromUrl(url='https://XYZ.sharepoint.com/sites/ala')

Creating saved target group in facebook audience

I need to create Saved Target Group in facebook programmatically like PowerEditor does it here https://www.facebook.com/ads/manage/powereditor.
During inspecting the browser's console when saving through the Power Editor I've discovered that such kind of an endpoint is used:
"https://graph.facebook.com/v2.2/act_#AD_ACCOUNT_ID#/audiences", but the method called is encrypted and there is no information about this kind of endpoint in the facebook API documentation.
Seems like Power Editor uses more extended API or not all the API is well documented.
Did anybody experience something similar?
Thanks
Not all of the functionality available in Power Editor is available in the public API or vice versa -
If what you're asking about is not in the public API documentation, it's not part of the API that is available publicly -
It would be dangerous to assume that an undocumented endpoint will continue to work or that it works in a specific way based on observing another app (Power Editor) calling it
You can use saved_audiences API.
Here is Graph Explorer request examples:
POST:
https://developers.facebook.com/tools/explorer/765026780221012?method=POST&path=act_&Fsaved_audiences&version=v2.5&name=foo&targeting={ "age_min":18, "age_max":65, "page_types":[ "desktop-and-mobile-and-external" ], "geo_locations":{ "countries":[ "US" ], "location_types":[ "home" ] } }
GET ALL:
https://developers.facebook.com/tools/explorer/765026780221012?method=GET&path=act_%2Fsaved_audiences&version=v2.5

Check JIRA REST API version?

How to check, that rest api is enabled in JIRA and it has appropriate version?
I know, that it is possible to request 'api/latest', but if latest installed version isn't compatible with methods, that i call?
To check that it is enabled, (and to disable it if you wish), then you will need to go to the Administration panel of your instance and enable/disable it there. Specifically you need to go to:
Administration > General Configuration > Set Accept remote API calls to either On/Off
To check if REST api is enabled, just go to (change the URL to your own)
https://jira.atlassian.com/rest/api/2/user
and see if the page loads.
I don't think there is a way using the API to get the API version, but you can make the API calls and fallback in case of an error. The coding depends on what you are trying to achieve.
You can find more info about the REST API at:
JIRA REST API Version 2 Tutorial
JIRA REST API documentation
If your stuck on the coding part, search Atlassian answers and SO or ask a question.
Use the /rest/serverInfo endpoint, e.g. /rest/api/2/serverInfo.
This should return a JSON string with JIRA version, e.g.
{
...
"version": "8.x.x",
...
}
View page source of Jira page and search version.
Sample output:
<meta name="application-name" content="JIRA" data-name="jira" data-version="7.9.2"><meta name="ajs-server-scheme" content="http">

iPhone facebook integration

I am using Graph API in my application. I am fetching user's facebook wall feeds using graph API also getting details of particular post i.e (Like count,Comments etc).
but i want to allow user to Like and Comment any post from the application itself.
what is the request format for that?
Please help me or give any pointers.
Regards,
Sanket
You would be well served to check out the Publishing section of the documentation. It provides information such as this.
One example is liking, which is defined as:
Method: /OBJECT_ID/likes
Description: Like the given object (if it has a /likes connection)
Arguments: none
Basically, just initiate a Graph API call to something like:
[facebookObject requestWithGraphPath:#"98423808305/likes" andDelegate:self];
That will "like" a picture from Coca-Cola (ID taken from the documentation).
Edit 1
According to the documentation:
Most write operations require extended permissions for the active user. See the authentication guide for details on how you can request extended permissions from the user during the authentication step.
Are you sure you have enough privileges? Unfortunately the documentation is very unclear as to whether it serves the dual purpose of liking the object and returning the likes already on that object.
Edit 2
I did some more research into what could be causing this and came across this question and answer that indicated that the code I posted above using requestWithGraphPath:: should work. However, it does not due to a bug on Facebook's Bug Tracker.
Unfortunately, it looks like there is no way to "like" an object via the Graph API, which seems very strange to me. Perhaps it is possible with the legacy REST API instead of the Graph API?
Edit 3
Well, it looks like your best bet is the stream.addLike method of the legacy REST API which you can still call using the Facebook iOS SDK. You should be able to use the stream.addLike method to "like" something in the "stream". Unfortunately, it doesn't appear to support photos, videos, etc. Only posts and comments.
Finally i found the solution for LIKE option
We should use following method for like option.
-(void) requestWithGraphPath:(NSString *)graphPath
andParams:(NSMutableDictionary *)params
andHttpMethod:(NSString *)httpMethod
andDelegate:(id <FBRequestDelegate>)delegate
graphPath = /OBJECT_ID/likes
Paramas = dictionary with comment ,for like option use empty dictionary
HttpMethod should be POST
you should get response = true if the LIKE request is successful.