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

Exclude Columns doesn't appear to work for "nested" api calls. #384

Closed
drmclean opened this issue Jan 22, 2015 · 2 comments
Closed

Exclude Columns doesn't appear to work for "nested" api calls. #384

drmclean opened this issue Jan 22, 2015 · 2 comments

Comments

@drmclean
Copy link

If I have a table of Computers and a table of Computer types I can define a relationship between ComputerTypes and Computers and then define API endpoints using manager.create_api()

If I then do:

 `GET /api/Computer/{id}`

It will return the info for the Computer with id={id} AND include the info from the related ComputerType (as expected).

If I add exclude_columns = ['ComputerType'] I no longer get the related ComputerType info. (again as expected)

However, if I do:
GET /api/Computer/{id}/ComputerType

Then it returns all of the relevant data from the ComputerType table AND the data from the related computer! I can't seem to prevent it doing this no matter what I exclude from either Computer or ComputerType.

Further more, if I were to include columns explicitly and only include the {id} column on both ComputerType and Computer tables then the following behaviour occurs:

GET /api/Computer : returns all Computer id's only
GET/api/Computer/{id} : returns the id of Computer with id={id} only
GET/api/ComputerType : returns the id's of all ComputerType's only
GET/api/ComputerType/{id}: returns the id of the ComputerType with id={id}

GET/api/Computer/{id}/ComputerType : returns me ALL info from row of the relevant ComputerType AND all information from the row of the relevant computer.

It seems like there is a way to include/exclude data from an endpoints like :
/api/table
or
/api/table/{id}

but no way to include or exclude from endpoints like:
/api/table/{id}/related_table

Is this a bug or am I doing it wrong?

@drmclean drmclean reopened this Jan 22, 2015
@jfinkels
Copy link
Owner

jfinkels commented Feb 2, 2015

I believe this is a duplicate of issue #211; if not, please reopen.

@drmclean
Copy link
Author

drmclean commented Feb 4, 2015

Hi thanks very much for the response and sorry for duplicating a question.
I'm not sure what to do with the knowledge that someone else also has this issue and has branched the repo.

Is the branch merged back? What steps should I go through to achieve an implementation where if I query /api/Computer/Id/ComputerType I actually get what I want (data on the type if computer/{id}) rather than loads of related info that I don't actually want?

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