Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Discrepancy between discover_api.json and content.py in routes #111

Open
dsikka opened this issue May 15, 2019 · 3 comments
Open

Discrepancy between discover_api.json and content.py in routes #111

dsikka opened this issue May 15, 2019 · 3 comments

Comments

@dsikka
Copy link

dsikka commented May 15, 2019

The file discover_api.json contains three possible actions: create, update, and get. Is there an example of how the update API call can be made for a client or sample data? Also, the content.py includes additional actions, such as delete. Is this endpoint still available? If yes, what as an example of of using this action? If not, how does one delete a client and any of their associated information?

@Dominique0804
Copy link
Contributor

Please see the attached documents.
api_complete_documentation.txt

I can also provide a video via email link. Please email help@baobablims.org

@dsikka
Copy link
Author

dsikka commented Jun 10, 2019

Thank you!

@dsikka
Copy link
Author

dsikka commented Jun 10, 2019

There seems to be a problem when trying to update existing samples.
Here is an example of the what I am trying to do:

A sample is first created using the following:

url = top_level_url + '/@@API/v3/create'
data = {
"BODY":
    '[{ \
        "portal_type": "Sample", \
        "SampleID": "id1000614", \
        "title": "def007001", \
        "SampleType": "Urine", \
        "Barcode": "bar00609", \
        "StorageLocation": "Room-1.Box-01.2", \
        "Volume": "20.00", \
        "Unit": "ml", \
        "parent_path": "clients/client-1/project-1" \
    }]'
}

request = requests.post(url, data=data, auth=auth)

The uid from request is extracted and the sample is updated using the following code:

uid = json.loads(request.content)['items'][0]['uid']
url = top_level_url + '/@@API/v3/update/' + uid
data = {"BODY":
            '[{"portal_type": "Sample", '
            '"SampleType": "Urine", '
            '"StorageLocation": "Room-1.Box-01.2", '
            '"Volume": "45.00", '
            '"Unit": "ml"}]'
        }
request = requests.post(url, data=data, auth=auth)

However, the response returns an error, indicating that a SampleType was not given in the payload when updating the sample. However, as you can see, it was defined as Urine.

This is the error:
b'{"_runtime": 0.008398056030273438, "message": "{\\"SampleType\\": \\"Sample Type is required, please correct.\\"}", "success": false}'

What is being done incorrectly here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants