I can successfully create a page in OneNote using the Rest API. I can also successfully indent a given page using patch. However, the issue is when I create a page and then want to indent it. I keep getting back:
<Response [404]>
{
"error":{
"code":"20102","message":"The specified resource ID does not exist.","#api.url":"http://aka.ms/onenote-errors#C20102"
}
}
I have tried putting in long delays between the call to create the page and the call to indent it. I have also tried looping over those delays so it will retry the patch every 10s. It is very rare that it actually succeeds within X number of tries.
Is there a better way to indent a newly created page?
Currently there is no way to do this with the OneNote API - my recommendation would be to do the following:
Create the page via POST pages
POST ~/pages
Poll the page via page content recall - this will return 404 until the page can be patched.
GET ~/pages/id/content
When the above returns 200, PATCH the page level
PATCH ~/pages/id/content
Obviously it would be better if you could directly create a page with a specific level. Please open a new suggestion in our uservoice and we will look into it.
https://onenote.uservoice.com/forums/245490-onenote-developer-apis
Related
I am trying to replace a production js file on a site with a local copy of it so I can set my own event listeners and control the layout of the page as needed. A lot of old stackoverflow answers suggest using fiddler to do that, but apparently the UI has changed since then. I have added the file I want changed to the autoresponder list but it does not have an option to return a file. The closest I've gotten is return a manual response which I have to copy and paste a 50k line javascript file every time. Can I get a more detailed explanation of how to do this in the new UI or was this removed from the free version of Fiddler Everywhere?
You can use the Auto Responder and create a rule that uses an external file. The file could contain the whole mocked response including the references (or the content) of the JS script.
To achieve the above use the last action from the Action drop-down which is named Choose saved response file ... (see more about the actions in this article).
I need to get the detailed list of the revisions for a Google Document.
When using the Google API Explorer on:
GET https://www.googleapis.com/drive/v3/files/{fileId}/revisions
I get only the non-detailed list.
Which is the API to call (or the parameter to set) in order to get something similar to what can be seen by pressing Show more detailed revisions?
Update:
I tried to "sniff" the browser traffic and I realized that Google Drive periodically requests the revision list to the URL:
https://docs.google.com/spreadsheets/d/{fileId}/revisions/history?id={fileId}&start=1&end=-1&zoom_level=0&token={token}
When clicking on Show more detailed revisions, the previous URL becomes:
https://docs.google.com/spreadsheets/d/{fileId}/revisions/history?id={fileId}&start=1&end=-1&zoom_level=1&token={token}
(the zoom_level parameter changes from 0 to 1)
I cannot find anything like that on the API reference, though. It seems that such an URL has to be invoked manually.
Therefore, I manually generated a token for the drive scope, manually checked it in order to keep it fresh and manually invoked that URL, in order to see what happened. Unfortunately, I got the following error on the browser:
Impossibile aprire il file in questo momento.
Verifica l'indirizzo e riprova.
which roughly means:
Unable to open the file at the moment.
Please verify the address and try again.
May somebody point me towards the right direction?
In the "Try it" section of the API there is a field called "fields". In there you can select the files you need from the response. If you write "kind,revisions" you will get the complete information or you can use the "fields editor" to select the fields you need.
Im currently writing a small Docpad plugin to output a documents contentRenderedWithoutLayouts into a separate .json file next to the .html version for loading it via an ajax request later.
The plugin works by overriding Baseplugin's render: (opts) -> method and doing a few checks whether we're rendering a document and to html.
I now noticed that this method gets called multiple times for some documents, which seems to be render pass related. So how can I detect the final render pass per document to avoid writing the .json multiple times per render?
Many Thanks
--
Edit:
found the answer after another look at Docpads events list: http://docpad.org/docs/events
The writeAfter event is the right place to get the final data and have the output directory tree set up so I can put my .json files next to the .html.
In case you're interested find the plugin here: https://github.com/field/docpad-plugin-jsonfragment
Another approach to this would be to use the serverExtend event, and write a router that detects if it is an ajax request (existance of the IS_XHR header) and then sends the necessary json data from that. This would require your hosting platform to support node.js as you'll be using the docpad server.
I'm trying to test a product to make sure it fails correctly and therefore want to be able to block a specific AJAX request from returning any data. I could modify the source to make the request fail but I have to prove it works without changing the code.
How could I go about blocking a specific url from returning data?
This might help - its a fire fox plugin - have not tried it but it looks good - it says it allows you to edit and alter requests- addons.mozilla.org/en-US/firefox/addon/tamper-data
I'm building a RESTful API for a personal project and the administrative area uses Ext. Since the API requires a token to be passed back and forth via the custom header 'X-API-Auth', I need to be able to add that to every Ajax request made by Ext.
For instance, in the user management area, I have a GridPanel, using a JsonStore, display a list of registered users. The 'autoLoad' property is set to TRUE. This way, when you first visit the screen, the GridPanel is automatically populated.
Before anything is rendered, I include the following headers:
Ext.Ajax.defaultHeaders = {
'X-API-Auth' : __API_KEY,
'Accept' : 'application/json'
};
Where '__API_KEY' is the token.
Now, my understanding is that these custom headers should now be sent with every Ajax call. When I first visit the member list page, I get a 403 Forbidden response thrown from the API. This is because the initial Ajax call the GridPanel makes is not sending the required headers. The API is functioning properly since, without the headers, it cannot authenticate the request.
Now, if I click the 'reload' button within the included PagingToolbar component associated with the GridPanel's JsonStore, it DOES send the headers. All Ajax calls to the member listing endpoint invoked manually yield the desired result.
Is there a reason why 'autoLoad' on a Store does not respect the 'defaultHeaders' property? If anyone can shed some light on this it would be greatly appreciated. I also asked this on the Sencha forums and noone seems to have an answer.
Thanks!
Alright, all that writing was for not. I messed up the order of operation. All these JavaScript files were being created by Ext Designer. I thought I was placing the 'defaultHeaders' property at the top of the path of execution, but it turns out I was wrong.
All fixed.
I'm going to go cut myself now.
/forever alone