Is it Possible to Add a Specimen through JS?

LabKey Support Forum (Inactive)
Is it Possible to Add a Specimen through JS? trent  2011-07-03 18:39
Status: Closed
 
I'm thinking the answer is No, but thought id post here just in case :-)

code:

        LABKEY.Query.insertRows({
                    'schemaName' : 'study',
                    'queryName' : 'SpecimenDetail',
                    'rows' : [
                            {
                                'VialId' : '6002',
                                'SampleId' : '6002',
                                'DrawDate' : '05/02/1990',
                                'ParticipantId' : '103',
                                'Visit' : '8',
                                'VolumeUnits' : 'mL',
                                'PrimaryType' : 'serum'
                            }
                        ],
                    'successCallback' : function(data){ console.log('complete'); },
                    'failure' : function(data) { console.log('incomplete');console.log(data);}
                });

Just get: 401: User does not have permission to perform this operation <stack trace omitted>

Or is this prevented due to the data model being more complex than inserting the data into a single view/table/list? I did try against both SimpleSpecimen, and the above.

In the case of a simple specimen repository, seemed like it may be a bit more usable if could build a form rather than copy, pasting the xls spreadsheet data (at least for the case of inserting information for a single specimen - but i guess there's some other behind the scenes [java code] stuff that goes on when inserting using the available method)
 
 
kevink responded:  2011-07-04 12:02
Unfortunately, no specimens can't be inserted or updated via a JS API. I added a Java API in 11.1 to insert or update specimens, but I didn't have the opportunity to wire it up to a JS api.

The SpecimenService.get().importSpecimens() Java API will insert or update specimens. Deleting specimens isn't supported unless all specimens are deleted and re-imported.