Update data file via API



  • Hello,
    is there a way to update content of data file via API?

    I tried to create it with following post

    POST /odata/data HTTP/1.1
    Host: XXXX.jsreportonline.net
    Content-Type: application/json
    cache-control: no-cache
    Postman-Token: XXX
      {
        "name":"Test",
        "content":{
        	"title": "hello"
        }
      }
    

    It created data file with specified name, but with no content. In response i did not get any error message. I also tried patch with edit link i get from post, but with no success.

    PATCH /odata/data('XXX') HTTP/1.1
    Host: XXX.jsreportonline.net
    Content-Type: application/json
    Authorization:XXX
    cache-control: no-cache
    Postman-Token: XXX
    {
    	"content": {
    		"test": "test"
    	}
    }
    


  • Please check the F12 browser tools and network. You get an idea what to send there.

    The body should be

    { 
      "dataJson": "{}" 
    }
    


  • Thank you. I successfully create data file via API. Now i can not save reseurces on template. I select some data file, click save, then close template window and reopen it and all data files are unselected. Any advice ?



  • This seems like a bug.
    We will take a look on it and come back to you.

    https://github.com/jsreportonline/main/issues/26



  • if it helps i am using jsreport online and in header is "jreport prod49 production"


Log in to reply
 

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