Dear Synapse developers, I am a new user using Synapse. I have some issues to locate my wiki subpage id and see the markdown file. Could you help with that? Attached is an example code I tried. The `syn23014871` is my project syn id. I have main wiki page and subpages for this project. `entity = syn.get('syn23014871')` `wiki = syn.getWiki(entity)` That gives me the main wiki and the associated metadata, but cannot find any information about subpage: `{'markdown': '# Focused group meeting\n- Metabolomics: Monday 10:00 AM-12:00 PM-Yating, Lei, Minghao-Others optional\n- Software projects: Thursday- Lei\n- Immunology: Friday 1:00 Pm - 03:00 PM Amnah, Minghao -Others optional\n\n## Regulatory network-based imputation of dropouts in scRNA-seq data.\n${image?fileName=Screen Shot 2020%2D10%2D09 at 1%2E05%2E07 PM%2E27eec131da4a469c8ed8b32839c67181%2Epng&align=None&scale=100&responsive=true&altText=}', 'id': '606381', 'etag': '1e4602d6-7754-413a-a357-85b6ef11566f', 'createdOn': '2020-10-09T14:22:36.102Z', 'createdBy': '3416108', 'modifiedOn': '2020-10-09T21:05:01.784Z', 'modifiedBy': '3416108', 'title': '', 'markdownFileHandleId': '66193122', 'attachmentFileHandleIds': ['66192341'], 'ownerId': 'syn23014871', 'markdown_path': '/Users/minghaogong/.synapseCache/122/66193122/66193122.md'}` I saw the > subpageId ? The id of the specific sub-page or None to get the root Wiki page But I don't know how to use it if it is helpful. Hope you can help! Thanks, Minghao Gong

Created by Minghao minghao.gong@jax.org minghao.gong
> (2) I expected here because I have 2 subpages, then I should I have 3 items in IdList (One is the main page and 2 subpages), rather than nothing. Correct: The wiki order hint is optional, as suggested by the word "hint". For example I made a project and gave its root wiki page two subpages. I can retrieve the three pages: ``` >>> syn.restGET("/entity/syn23519572/wikiheadertree") {'totalNumberOfResults': 3, 'results': [{'id': '606618', 'title': ''}, {'id': '606619', 'title': 'first wiki subpage', 'parentId': '606618'}, {'id': '606620', 'title': 'second wiki subpage', 'parentId': '606618'}]} ``` However, since I have not set any order hints, there are none to retrieve: ``` >>> syn.restGET("/entity/syn23519572/wiki2orderhint") {'ownerId': '23519572', 'ownerObjectType': 'ENTITY', 'etag': '1b699094-bdc0-4b87-a078-e0d75ed76a8e'} ``` > The first thing I see here is that the wiki2orderhint really doesn't clarify the hierarchy of the tree structures. That is correct. The order hints are a list, not a tree structure. > That makes me wonder how to reshape the tree structures easily without moving them on the web. You would use this API: https://rest-docs.synapse.org/rest/PUT/entity/ownerId/wiki/wikiId.html Note that the request object has a field, `parentWikiId`. When you change this field you change the tree structure, moving the wiki page under a different page. > Do you mean if I want to modify the tree, I need to re-upload all the pages according to the sequence I want? No, you only have to modify the pages you wish to move. Once you change the tree structure using this request, you may also need to restate the 'order hint' to get the pages in the order you prefer. The API for doing this is: https://rest-docs.synapse.org/rest/PUT/entity/ownerId/wiki2orderhint.html
I am sorry that maybe I think that is obvious. ####1st question here is about the following scenario: (1)`syn.restGET("/entity/syn23014871/wiki2orderhint")` (2) I expected here because I have 2 subpages, then I should I have 3 items in IdList (One is the main page and 2 subpages), rather than nothing. (3) What I got here doesn't have Idlist. `{'ownerId': '23014871', 'ownerObjectType': 'ENTITY', 'etag': '317c8f9e-326f-4de5-8902-cb7680998b43'}` ${imageLink?synapseId=syn23518604&align=None&scale=61&responsive=true&altText=} ####2nd questions - when I have very intensive hierarchical structures of my subpages after a long-run, I want to modify the structure (parents and childrens) and sequence of the subpages - The first thing I see here is that the wiki2orderhint really doesn't clarify the hierarchy of the tree structures. - That makes me wonder how to reshape the tree structures easily without moving them on the web. - And unfortunately, I don't understand your answer here (how can I modify the wiki to be able to change the tree structures?). > You don't modify the whole tree, you modify each page. The tree is the cumulative report of all the pages. The service to modify a page is: Do you mean if I want to modify the tree, I need to re-upload all the pages according to the sequence I want? That doesn't make sense in practice and also it doesn't tell the program to recognize the hierarchical structure. I think there must be Sth. I am completely ignorant if that is going to answer my question. Hope you can help! Many thanks! Best, Minghao Gong
I see that you posted some commands and the results that you got back ((1) and (3)) but it's not clear what result you expected (2).
I attached images (with codes and results screenshot from jupyter notebook)down there after the quoted sessions. Could you see that? And the images and files are all in the public available test project here. Could you see that? [https://www.synapse.org/#!Synapse:syn23184078/wiki/606504]
> But is there a way to PUT it back after modifications? You don't modify the whole tree, you modify each page. The tree is the cumulative report of all the pages. The service to modify a page is: https://docs.synapse.org/rest/PUT/entity/ownerId/wiki/wikiId.html > With the project only including two subpages, it doesn't render those idList. I'm sorry but I don't understand this statement. It would help if you provided (1) the command you used, (2) the expected result, (3) the actual result. > I tested if I have subpages after subpages, then the idList cannot distinguish those nested structures. Again, I'm sorry but I don't understand this statement. It would help if you provided (1) the command you used, (2) the expected result, (3) the actual result.
I saw there is a function [GET wikiheader tree](https://docs.synapse.org/rest/GET/entity/ownerId/wikiheadertree.html). But is there a way to PUT it back after modifications? Thanks, Minghao Gong
Thanks @brucehoff, I encountered some more questions here when I implemented the restGET. I have tried the following with [this test project](https://www.synapse.org/#!Synapse:syn23184078/wiki/606504) and some others. - It is interesting that only if I have > 5 subpages then I can get the `idList`. With the project only including two subpages, it doesn't render those idList. ${imageLink?synapseId=syn23518610&align=None&scale=40&responsive=true&altText=} ${imageLink?synapseId=syn23518604&align=None&scale=41&responsive=true&altText=} - Is that so? - Further, I tested if I have subpages after subpages, then the idList cannot distinguish those nested structures. ${imageLink?synapseId=syn23518637&align=None&scale=39&responsive=true&altText=} It is the [same project](https://www.synapse.org/#!Synapse:syn23184078/wiki/606504) here. - So is there another function to rebuild the tree structure of the subpage? - And then how to manage the order of subpages if I have nested structures. Thanks very much! Minghao Gong
Yes, the API for doing so is documented here: https://rest-docs.synapse.org/rest/PUT/entity/ownerId/wiki2orderhint.html You can call it from the Python client using https://python-docs.synapse.org/build/html/Client.html#synapseclient.Synapse.restPUT
Hi Brucehoff, @brucehoff Can I organize and change orders of the wiki subpages using command line instead of doing it manually on webpage? Thanks, Minghao Gong
THanks@brucehoff, That is very helpful! Best, Minghao Gong
Please see https://python-docs.synapse.org/build/html/Client.html#synapseclient.Synapse.getWikiHeaders The input parameter is the Synapse id of the entity. Each element of the result contains a field 'id' which is the wikisubpage id and a field 'parentid' which is the wiki page id of the parent page. So the ids of the subpages of the root pages are the 'id's of all the records in the returned list whose parentid field equals the id of the root wiki page. To get the content of a subpage please use https://python-docs.synapse.org/build/html/Client.html#synapseclient.Synapse.getWiki where 'subpageid' is the wiki page id for the page of interest.

How to locate the wiki subpage id? page is loading…