Manipulating Specimens using R API

LabKey Support Forum (Inactive)
Manipulating Specimens using R API eva pujadas  2016-07-28 03:05
Status: Closed
 
We are trying to access / modify specimens using Rlabkey without success.

While trying to update one of the tables with R, we got the following error message:
> labkey.insertRows(baseUrl = baseUrl,
+ folderPath = folderPath,
+ schemaName = "study",
+ queryName = "LocationSpecimenList",
+ toInsert = test)
Fehler in processResponse(mydata, header, handle) :
  HTTP request was unsuccessful. Status code = 500, Error message = The query 'LocationSpecimenList' in the schema 'study' is not updatable via the HTTP-based APIs.

Is it basically possible to manipulate specimens using the R API?

Thanks and best,
Eva
 
 
Jon (LabKey DevOps) responded:  2016-07-28 11:28
Hi Eva,

Have you thought about trying to do your insert on the SpecimenDetails table instead?

Regards,

Jon
 
eva pujadas responded:  2016-07-29 01:30
Hi Jon,

Thanks a lot for your answer. Unfortunately, with the mentioned query „SpecimenDetail" we get exactly the same error message:

> labkey.insertRows(baseUrl = baseUrl, folderPath = folderPath, schemaName = "study", queryName = "SpecimenDetail", toInsert = test_insert2)
Fehler in labkey.insertRows(baseUrl = baseUrl, folderPath = folderPath, :
  HTTP request was unsuccessful. Status code = 500, Error message = The query 'SpecimenDetail' in the schema 'study' is not updatable via the HTTP-based APIs.

Do you have some other possible hint?

Thanks and regards,
Eva
 
Jon (LabKey DevOps) responded:  2016-07-29 13:02
Hi Eva,

Just curious, what kind of Specimen Repository do you have? Is it the Standard Specimen Repository or is it the Advanced (External) Specimen Repository?

I have the advanced version running on my test and I was able to insert into my SpecimenDetail table without any trouble via JavaScript:

<button onclick="buttonClick()">Click Me</button>


<script type="text/javascript">

function buttonClick(){

LABKEY.Query.insertRows({
    requiredVersion: 9.1,
    schemaName: 'study',
    queryName: 'SpecimenDetail',
    rows: [{
                "ParticipantId": '00003',
        "SequenceNum": '1.0',
        "GlobalUniqueId": '23452345234523452345',
                "Volume": '123'
             }],
             successCallback: function(data){
            alert('Successful!');
             },
});

}
</script>

Can you go into your Study under the Manage tab and click on "Change Repository Type" and tell me what you see there?

Regards,

Jon
 
Jon (LabKey DevOps) responded:  2016-07-29 14:58
Hi Eva,

Also, if you are set to the Advanced Specimen repository already, confirm it is set to Editable as well.

Regards,

Jon
 
eva pujadas responded:  2016-08-01 23:45
Hi Jon,

Thanks a lot for bringing us to the right solution; the repository was not set to „Editable“ - after changing that the R-api works now (see below):

> labkey.insertRows(baseUrl = baseUrl, folderPath = folderPath, schemaName = "study", queryName = "LocationSpecimenList", toInsert = test_insert)

$rowsAffected
[1] 1

$queryName
[1] "LocationSpecimenList"

$schemaName
[1] "study"

$containerPath
[1] "/Steinmann3"

$rows
list()

$command
[1] „insert"


Thanks once more for your great support!
Eva