Set Study Reload programmatically

LabKey Support Forum (Inactive)
Set Study Reload programmatically tbrachmann  2017-10-16 10:56
Status: Closed
 
Hello,

I'm wondering if its possible to send an HTTP request to allow a study to be reloaded. Not the trigger to reload the study, but to configure the study for manual reload. I am importing all of our studies into LabKey, and would like future studies to reload automatically.

I can send a POST request with my credentials and the data "allowReload=true" to http://<server>/<project>/<study>/study-manageReload.view? but I get back the error "401: This request has an invalid security context". Is there any way around this?

Thanks.
 
 
jeckels responded:  2017-10-16 17:49
Hello,

Yes, this is possible, though we don't have a formal API for it.

You're getting that error due to our cross-site request forgery protection:

https://www.labkey.org/Documentation/wiki-page.view?name=csrfProtection

You will need to make two separate requests, one to authenticate and get the CSRF token, and another to make the actual reload request. This thread discusses one way to do it:

https://www.labkey.org/home/Support/Developer%20Forum/announcements-thread.view?rowId=11385

Thanks,
Josh