Accessing templates within folders using URL-params (CRUD)?



  • As described in the api documentation, we can access templates within specified folders by passing the full path of the template within a HTTP-post call. But what should that call look like if I want to get all Templates from a specific folder?

    Calling http://localhost:5488/odata/templates returns a list of all templates. But how do i pass the folder name into that call so the response only returns my dummyPrint template from my print folder?

    Folder-Structure:
    0_1550224023341_upload-dea672dd-7dba-4d2f-9397-fb53a209aa8c


  • administrators

    you can change the query to be http://localhost:5488/odata/templates?$filter=folder/shortid%20eq%20%27<shortid of folder>%27 just replace the <shortid of folder> with the shortid of the folder, to see the shortid of a folder just do a right click and then "Edit", you will see in the url the shortid of the folder



  • Great! Thanks. The only downside is that i need to know the shortid of my folder in advance.

    I'm running jsreport on two different servers (one for development and one for production) so the shortid for my "print" folder will differ on each server. Is there a way to pass the folder name instead of the shortid in the URL?


  • administrators

    I'm running jsreport on two different servers (one for development and one for production) so the shortid for my "print" folder will differ on each server. Is there a way to pass the folder name instead of the shortid in the URL?

    i think there is no way at the moment. however you can get the shortid of folder by using another query by name. for example to search folder with name templates it will looks like this http://localhost:6200/odata/folders?$filter=name%20eq%20%27templates%27, however this query can give you multiple entities because there can be other folders (subfolders) named templates at different hierarchy levels. you can make the query more specific by specifying that you are searching folders at the root, it will look like this http://localhost:6200/odata/folders?$filter=name%20eq%20%27templates%27%20and%20folder%20eq%20null



  • And it works :) Requesting the shortId of my default folder name first and passing the shortId to a second query to get the template contents is good enough. Thanks for the quick help!


Log in to reply
 

Looks like your connection to jsreport forum was lost, please wait while we try to reconnect.