#1
Hi all,

I am trying to understand how to modify the API but I always end up breaking things. I am trying to understand how I can change say the find one to search within a different column, like say username, or email address.

Thanks
#2
Hello,

Are you modifying the API in the Assets folder of a Module?
Or elsewhere?

Dan
#3
Hi,

Getting the API instructions right is super important. So, I'd like to do a video response for this one.

Please do tell me what it is you'd like me to cover? There are no stupid statements here. If you can help me by telling me what you're hoping to do and precisely what issues you've encountered then I promise to make a video tutorial that covers whatever is on your mind. Same goes for anyone else who is having issues with this.

Give me as much detail as possible. Let me know what you'd like clarification about. Once again, there are no stupid questions here.

DC
#4
Hi,

Getting the API instructions right is super important. So, I'd like to do a video response for this one.

Please do tell me what it is you'd like me to cover? There are no stupid statements here. If you can help me by telling me what you're hoping to do and precisely what issues you've encountered then I promise to make a video tutorial that covers whatever is on your mind. Same goes for anyone else who is having issues with this.

Give me as much detail as possible. Let me know what you'd like clarification about. Once again, there are no stupid questions here.

DC
#5
I modified the auto-generated "find one"


And it pulls it through, but when I try the "exists" one



It comes back with 200 ok, but returns false, but if I put in the id it says true.
#6
I have tried these 2


Find one works and gives a response. But the Exists one comes back as false, but if I put the ID number in, it comes back as true.
#7
Hi nturton240,

I know DC was or is going to do a video on your enquiry but the problem here is very simple.

When you try to change the API endpoint for 'Exists' to anything other than an integer it will 'fail' because if you trace back the code in 'Standard_endpoints.php' and look at the exists() method from lines 168 & 169:

On line 168 - $target_segment will equal 4 with "url_segments": "api/exists/ussers/{username}"

On line 169 - $update_id will equal 0 if your placeholder "{username}" is a string

It is as simple as that.