Table of Contents |
---|
...
- Download the CSV template file
- Upload the CSV file
- Create and run the import job
- Check the job status
- Download the job report
Download the CSV template file
...
application/json
...
Follow the below steps to download the template file:
Login to OpenSpecimen → Navigate To → Collection Protocols → More → Import Biospecimen Data (CSV) → Choose the Record Type → Click on Download Template
Upload the CSV file
Attribute | Value | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
URL | http://<host>:<port>/openspecimen/rest/ng/import-jobs/input-file | |||||||||
Method | POST | |||||||||
Request Type | form-data | |||||||||
Response |
|
...
Note |
---|
Note down the 'fileId' as this will be used in step #3 |
Create and run the import job
Attribute | Value | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
URL | http://<host>:<port>/openspecimen/rest/ng/import-jobs | |||||||||
Method | POST | |||||||||
Request Type | application/json | |||||||||
Request |
|
...
Note |
---|
|
Check the job status
Attribute | Value |
---|---|
URL | http://<host>:<port>/openspecimen/rest/ng/import-jobs/{job-id} |
Method | GET |
Request Type | application/json |
Download the job report/output
...
Code | Applies to | Status Message |
---|---|---|
200 | All requests | Bulk Import request was successfully processed. |
401 | All requests | Authorisation failed, user doesn’t have the authority. |
500 | All requests | Internal server error, encountered server error while performing operations. |
Sample Code
The following is the sample python code to do bulk import for Specimen Events: bulk_import.py
Info |
---|
python3 bulk_import.py <CSV_FILE_NAME> |