API documentation by template



  • Dear jsReport-Team,

    i am missing a way to express what data structure my template expects. This info should be displayed for someone who wants to post some data to request a generated pdf via the API (http://localhost:5488/api/report) .

    Currently i can see all templates like this:
    http://localhost:5488/odata/templates?$select=name

    {
      "@odata.context": "http://localhost:5488/odata/$metadata#templates(name)",
      "value": [
        {
          "name": "sales-main",
          "_id": "u1WR0ZHBIg3Wehel"
        }
    ...
      ]
    }
    

    What I would love to see:
    http://localhost:5488/odata/templates?$select=name

    {
      "@odata.context": "http://localhost:5488/odata/$metadata#templates(name)",
      "value": [
        {
          "name": "sales-main",
          "_id": "u1WR0ZHBIg3Wehel",
          "expected-data":
                   {"name": string,
                    "location":[number],
                     "children":[{
                       "name": string,
                       "age": number}]}
           }
        }
    ...
      ]
    }
    

    I would also like to add a description of the parameters but this is all optional :))

    Thank you for all your work you really did a great job.

    Cheers,
    Bernd



  • Hmm, typically you associate the sample data with the template and this describes the expected data.
    You just need to query the data based on the template.

    http://localhost:5488/odata/data?$filter=shortid eq 'xxxxxx'
    

    Would this approach work for you?
    Additionally, we could support adding comments to the sample data json.



  • Thanks a lot jan i will try this later. This is really a great idea. :)

    I guess this will work and will do the job.

    Cheers,
    Bernd


Log in to reply
 

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