Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

octuslimb's avatar

Laravel Nova Question: Import data from API

Hello, I am new to Nova and wondering how you would approach this. I have a model called Product and a Nova resource and it has a bunch of fields like weight, height, length etc. I want to pull this information from the amazon API. So the administrator would enter the ASIN (unique product id on amazon) on nova then somehow populate the fields from the API?

I was thinking of adding a resource action called "sync with amazon" and the action would populate the fields after the product is created, but maybe you guys have better ideas?

0 likes
2 replies
octuslimb's avatar

Hello, I am new to Nova and wondering how you would approach this. I have a model called Product and a Nova resource and it has a bunch of fields like weight, height, length etc. I want to pull this information from the amazon API. So the ad https://192168ll.link/ ministrator would enter the ASIN (unique product id on amazon) on nova then somehow populate the fields from the https://routerlogin.uno/ API?

I was thinking of adding a resource action called "sync with amazon" and the action would populate the fields after the product is created, but maybe you guys have better ideas? issue got solved

webrobert's avatar

@octuslimb,

maybe the simpler way to look at this is like MVC but instead of getting the data from your model you get it from the api/service. I typically create a class for the api in Services directory, like AmazonApi.php

Many APIs have a php counterpart. But I often find I'm happy to whip up what I need.

Then you can call it in your controller or in a job etc.

...
 AmazonApi->getProductByASIN(request('ASIN'))

I'll also map the response in that class. so whatever response coming back is already in the correct format.

...
$productDetails = (new AmazonApi())->getProductByASIN(request('ASIN'));

$product->update($productDetails);

Please or to participate in this conversation.