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

bitbucket: API exposes both id and pk #11

Open
rzelayafavila opened this issue Nov 6, 2017 · 0 comments
Open

bitbucket: API exposes both id and pk #11

rzelayafavila opened this issue Nov 6, 2017 · 0 comments

Comments

@rzelayafavila
Copy link
Contributor

Copied from bitbucket issue #13: (priority: minor)
https://bitbucket.org/greenelab/django-genes/issues/13/api-exposes-both-id-and-pk

@mhuyck commented:
"""
The API for django-genes can be inspected via Tastypie at, e.g.:

http://hostname/api/v0/gene/schema/?format=json

When I do this for the installation we have on adage-server, I get the following:

{
  "allowed_detail_http_methods": [
    "get"
  ],
  "allowed_list_http_methods": [
    "get"
  ],
  "default_format": "application/json",
  "default_limit": 50,
  "fields": {
    "aliases": {…},
    "description": {…},
    "entrezid": {…},
    "id": {…},
    "obsolete": {…},
    "pk": {…},
    "resource_uri": {…},
    "standard_name": {…},
    "systematic_name": {…},
    "weight": {…},
    "xrids": {…}
  },
  "filtering": {
    "entrezid": 1,
    "pk": 1,
    "symbol": 1
  }
}

It seems from the code (and the API itself, see "filtering" section) that the intent was to expose pk in place of the internal id, but we are getting both. This is because GeneResource automatically picks up all of the fields from the Gene model backing it and Gene extends model.Model, which includes an auto-generated id.

This is a minor issue, but it does create a bit of confusion when using the API as to which field should be used as an identifier.

"""

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

No branches or pull requests

2 participants