DaemonForums  

Go Back   DaemonForums > Miscellaneous > Programming

Programming C, bash, Python, Perl, PHP, Java, you name it.

Reply
 
Thread Tools Display Modes
  #1   (View Single Post)  
Old 9th August 2019
LeFrettchen's Avatar
LeFrettchen LeFrettchen is offline
Marveled user
 
Join Date: Aug 2012
Location: France
Posts: 408
Default Laravel JsonApi

Hi everybody.

I'm currently in an dev internship, and I have to create APIs with php/Laravel/JsonApi.
I use {json:api} and https://laravel-json-api.readthedocs.io/en/latest/

No problem with php and Laravel, but I'm stuck with JsonApi, with some id name issue !
Problem is, I'm the first in the enterprise to use JsonApi, so none of my colleagues can help me.

I use the {json:api} official manual everyday, and I've tried everything described but can't find a functional solution in-there.
I've asked on Stack Overflow, no response...

Maybe someone knows how to use Laravel and JsonApi, or knows someone who could help...
__________________
ThinkPad W500 P8700 6GB HD3650 - faultry
ThinkStation P700 2x2620v3 32GB 1050ti 3xSSD 1xHDD
Reply With Quote
  #2   (View Single Post)  
Old 10th August 2019
J65nko J65nko is offline
Administrator
 
Join Date: May 2008
Location: Budel - the Netherlands
Posts: 4,128
Default

It looks like you solved it yourself ;-) : https://stackoverflow.com/questions/...ravel-json-api
__________________
You don't need to be a genius to debug a pf.conf firewall ruleset, you just need the guts to run tcpdump
Reply With Quote
  #3   (View Single Post)  
Old 10th August 2019
LeFrettchen's Avatar
LeFrettchen LeFrettchen is offline
Marveled user
 
Join Date: Aug 2012
Location: France
Posts: 408
Default

I wish, but unfortunately nope.
That was the easiest part, cause it returned a 500 error, which meant it was a Laravel problem.

That is fixed, but now I get a 404 error, so it's a SQL error, and I don't know how to fix it.
__________________
ThinkPad W500 P8700 6GB HD3650 - faultry
ThinkStation P700 2x2620v3 32GB 1050ti 3xSSD 1xHDD
Reply With Quote
  #4   (View Single Post)  
Old 19th August 2019
LeFrettchen's Avatar
LeFrettchen LeFrettchen is offline
Marveled user
 
Join Date: Aug 2012
Location: France
Posts: 408
Default

OK, I went back to my internship after a week of vacation, and found where my error was.

I used artisan to generate an adapter, and I thought it was good, but nope.
artisan generates an empty find() method in the adapter, so ofc, this won't work.

I digged into the Laravel-json-api github, and found how to define the find() method :

Code:
public function find($resourceId)
{
    return $this->findQuery($resourceId)->first();
}
Now, we're talking
__________________
ThinkPad W500 P8700 6GB HD3650 - faultry
ThinkStation P700 2x2620v3 32GB 1050ti 3xSSD 1xHDD
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 11:54 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick