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

/people endpoint: blank values should be skipped #2

Open
j-ro opened this issue Aug 7, 2015 · 6 comments
Open

/people endpoint: blank values should be skipped #2

j-ro opened this issue Aug 7, 2015 · 6 comments

Comments

@j-ro
Copy link

j-ro commented Aug 7, 2015

Testing here:

http://camus.fuzion.co.nz/hal-browser/browser.html#/sites/default/ext/osdi/api/v3/People/index.php

Blank values should be simply not returned. Right now, "" is being outputted for blank names, null for other blank values, etc... Instead, if there's no data, the field should be not included.

@joemcl
Copy link

joemcl commented Aug 7, 2015

Jason, if some records have data in these fields - first name, last name etc - and others do not - and these are dummy records simply for testing the implementation - we don't want to exclude first name (given name), last name (family name), etc. I'll fill in some of the missing data in the dummy records. but would rather not exclude those fields.

@j-ro
Copy link
Author

j-ro commented Aug 7, 2015

That's not what I'm saying. I'm saying if no data exists for that particular person on that field, the endpoint should not return the field, rather than showing a blank field. If it exists for another person, of course it should be returned.

So, for dummy people that don't have first names, the first name field should not be on their resource. For ones that do, it should be there.

@joemcl
Copy link

joemcl commented Aug 7, 2015

Got it, thanks. Any empty or null field for any record should not be returned.

@anuditverma
Copy link
Owner

I started resolving this issue first, there are numerous ways which do not allow to print/return the field when it is empty but actually I have used the library https://github.com/blongden/hal which uses array() within a function to generate the embedded resource. So if I try to use something like if(!empty($myarray)) {//return field} against each field to check if it is empty or not but this can't be done done within the array() when I inline this if expression in front of the fields. I am figuring out to how do this, I'll try different approaches like creating a separate function before passing in the values or I'll try to make changes in the Get.php entity file.

@j-ro
Copy link
Author

j-ro commented Aug 8, 2015

I'd guess that checking for emptiness before passing the values to HAL is the way to go. But Eileen might have other suggestions.

@eileenmcnaughton
Copy link

no - checking & eliminating empties sounds like part of the role of reformatting CiviCRM API output to osdi output - which would be done in this extension

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

4 participants