Dear all,
I have just upgraded my json_api from 1.x to 2.3.
Reading the documentation that says this
filter[uid.uuid][value]=BB09E2CD-9487-44BC-B219-3DC03D6820CD
My filter like this
?filter[field_lead.uuid][value]=dd9ef2a3-640d-4282-9a86-835625670a7e
should work...
But it does not... (it gives me a 400) ;-)
After finding this: https://www.drupal.org/node/3015183, just now, i would assume that this should work
?filter[field_lead.id]=dd9ef2a3-640d-4282-9a86-835625670a7e
Then i get a 200, but the data[] is empty...while i know for sure it should not be
Am i missing something stupid here?
Comments
Comment #2
guardian87 commentedComment #3
guardian87 commentedComment #4
gabesulliceSee https://www.drupal.org/node/3015183 :)
All breaking changes (and most new features are listed here): https://www.drupal.org/list-changes/jsonapi
Thanks for pointing out the documentation, which page was that on so we can update it?
Comment #5
gabesulliceLeaving as active actually, for the question in #4.
Comment #6
gabesulliceOhhh, sorry! I completely missed the second part of your issue:
🙈
This is probably due to: https://www.drupal.org/sa-contrib-2018-081
There are lots of docs about these hooks in
jsonapi.api.phpComment #7
guardian87 commentedThanks for getting back to me.
The docs is was referring to are these:
https://www.drupal.org/docs/8/modules/jsonapi/filtering
I don't really understand the sa-contrib-2018-081 link, since i have just upgraded to json_api 2.x
So im kinda left with my initial question, how can i get this filter to work on 2.x?
because the empty data[] is wrong in my example, that i know for sure...it seems like it is just filtering on uuid?
Comment #8
wim leers🥳
Which entity type is this happening for? Does it happen to be a custom one?
Comment #9
guardian87 commentedHi Wim,
yes, they are ECK entities.
Comment #10
gabesullice@guardian87, that explains it then. Custom entities need to have one of the entity-level hooks implemented for them. I just published a new change record. Feel free to ask any specific questions about how to implement them if the docs aren't clear.
https://www.drupal.org/node/3036792
Comment #11
guardian87 commentedOh i see...
So this is a requirement as of json_api 2.x then?
As it was working in 1.x?
Sorry, i could have specified the eck usage in my question.
[EDIT]
Oh, i see, as of 1.24 this was changed if i read this correctly?
I upgraded from 1.23.
Comment #12
gabesulliceYep, since it was a security issue, it was applied to both the 1.x and 2.x branches.
Comment #13
guardian87 commentedAs a quick test, to see if this is actually my problem, i just implemented something like this
Obviously this is not what i want to keep, but i just want to figure out if it actually solves the problem at hand.
So far there is no difference when implementing these...
Am I missing something?
Ps: The hooks do get invoked though..
Comment #14
wim leersPlease go to
http://example.com/rebuild.phpas the admin user first, or dodrush cr.Comment #15
guardian87 commentedHi Wim,
I did that before posting ;)
Okay nevermind...
cleared cache 3 more times, now its good :(
Sometimes i hate you drupal ;)
Thanks guys.
Comment #16
wim leersIn Drupal code bases, you clear caches. In JS code bases, you need to create a build. In C code bases, you need to compile. Just different trade-offs.
Drupal's trade-offs enable non-programmers to assemble web sites from components without needing to knowing any programming :)
Comment #17
guardian87 commentedTell me about it, after all these years of dev, it still gets me apparently. ;-)
Comment #18
wim leers:)