Created By and last Modified By for Get pages - onenote

Do we have a way to identify who created the page (Created by in Get pages request) using API call? We see the properties Created By and last Modified By for Get sections. Can we get the same properties for Get pages?

Currently the OneNote GET ~/pages API does not support the properties "CreatedBy" and "LastModifiedBy. I would recommend creating an item in UserVoice (I will upvote it ;) )
https://onenote.uservoice.com/forums/245490-onenote-developer-apis

Related

Attempting to read the HTML to find the price of XRP from my broker

I'm trying to create a Google Apps Script that pulls a specific value from this webpage https://www.luno.com/en/price/XRP. I'm attempting to read the HTML to find the value that I'm looking for which the price of XRP from my broker, denoted as "MYR". Here's the code I'm trying to use.
function getXRP(){
var html = UrlFetchApp.fetch('https://www.luno.com/en/price/XRP').getContentText();
var loc = html.indexOf("MYR");
return html.substring(loc, loc+8);
}
From what I understand, html.indexof("MYR") is returning a value of 0, hence the output I'm getting is the first 8 characters of the websites XML
<!DOCTY
For reference, I'm trying to capture the price as below and insert it into my Google Sheets document. Any help would be greatly appreciated, Thank you!
html.indexOf("MYR") is returning -1 because the source code of the page that you are fetching doesn't include MYR.
UrlFetchApp.fetch('https://www.luno.com/en/price/XRP').getContentText() can't be used to fetch dynamic content, instead you should find some way to create a headless browser and parse the rendered DOM instead of the source code.
Related
Using Apps Script to scrape javascript rendered web page
Is it possible to use Google Apps Script to get an info from the code I see at DevTools?
You can just use their API service and fetch the price: https://www.luno.com/en/developers/api#tag/Conventions
It'll be less overhead to fetch from a API than to scarp the whole webpage, parse the field by ID or name and then insert it into the spreadsheet. Fetching from API is lot easier and resource friendly.

Why can't I add a existing MediaItem to an existing Album using the online Api Explorer?

I'm using the albumId that I got from the albums.list method. It is, in my eyes, a valid ID, because I can use the albums.get method to get the album.
I'm using the mediaItemId that I got from the mediaItems.list method. It is, again in my eyes, a valid ID, because i can use the mediaItems.get method to get the mediaItem.
Both work without problems!
When I'm trying to add the mediaItem to the album, using the albums.batchAddMediaItems method, I get an
error: No permission to add media items to this album.
I used OAuth 2.0 and checked every scope that can be checked.
I asked the same question. I posted an answer there:
Google photos api adding photos to existing album is broken
See "Media items can be created only within the albums created by your app. For more information, see Authentication and authorization scopes." from this link: https://developers.google.com/photos/library/guides/upload-media
The jist of it is that google api wont let you programatically modify an album that wasnt also created programatically. If you create the album via the api, get the response with the ID and then append to the album afterward. You shouldn't see that error response.

JSON storage via API

I'm hoping to store a JSON file and access it through javascript in a Qualtrics survey. The information does not need to be password protected and I don't want to include any credentials in the Qualtrics survey.
I've been using links to anonymous gists eg. (https://gist.githubusercontent.com/anonymous/591cf9b1dd8fa70d97451cd1569f89be/raw/9984f8f22929d29d6f612189212059bce5157ca4/a_file), but every time I update a gist, that link changes. So, every time I want to change the contents of the gist, I need to copy the new link into the Qualtrics survey Javascript (unfortunately, I can't do this automatically easily in Qualtrics).
I'd like to be able to post the JSON somewhere that I can update programmatically without changing the link. Does anyone have suggests of an API I can use for this purpose? Thanks a lot!
Why not use github's api to get your gist's content by using the gists id.
So for
https://gist.githubusercontent.com/anonymous/591cf9b1dd8fa70d97451cd1569f89be/raw/9984f8f22929d29d6f612189212059bce5157ca4/a_file
the id would be 591cf9b1dd8fa70d97451cd1569f89be and then you can make get requests to https://api.github.com/gists/591cf9b1dd8fa70d97451cd1569f89be. You may need to have public gists though, not anonymous gists to be able to update a gist and use it's id to track changes.

Wordpress api, getting users data

I'm currently working on an application in titanium appcelerator, alloy - where I'm pulling data from wordpress via rest api.
My problem now is that I need to get the data from the the users of the of the wordpress site. Info like name, email ect.
Anyone ever tried or know how it's done? The end tag: /users? Doesn't seems to be enough
In accordance with official documentation on WP-API docs data that you need is not accessable through standart API requests and endpoints (it is only "visible" during editing).
But you can create your own route and using internal API/hooks to get all data and return it in json format in prefered way (see Adding Endpoints section on provided before site).

google documents api pagination

I am using google documents API. I need to implement pagination.
I used like below.
First page:
qry.setMaxResults(10);
qry.setStartIndex(1);
Second page:
qry.setMaxResults(10);
qry.setStartIndex(11);
I am getting same 10 results for second page also.
This question has this as answer link.
I am unable to find any answer in this link.
Can any one help me?
Thanks in advance..
The Documents List API uses "next" tokens for pagination and not the start index:
https://developers.google.com/google-apps/documents-list/#getting_all_pages_of_documents_and_files
To retrieve all pages of documents, you start from the beginning and then follow the link with rel=next to get more pages.
The max results parameter is used to limit the number of elements in each page.
Remember you can (and should) also use the newer Drive API to perform the same task:
https://developers.google.com/drive/v2/reference/files/list