Issue Setting up API for Inventory

So I’m still brand new to all this so please bare with me. I’m trying to set up an API request that brings in a list of current inventory items at specific Home Depot stores. I set up a button labeled ‘Shop This Store’, and I want to attach the necessary action to this button so that once they click it, it brings up the list of items currently in stock for the selected store. That screen looks like this:

So I go to set up a custom action, and these are the following steps I’m taking:

  1. I go to create a new custom action for that button
  2. I name it InventoryItems and for Type I’m selecting ‘Create’ (I’m assuming that’s correct?)
  3. I’m using BigBoxAPI, and I paste the URL it provides as the API Base URL: https://api.bigboxapi.com/request?api_key=6C2E5BAD63C04D5BA914FBF3FADCEE8E&search_term=lawn+mower&type=search
  4. For Method I’m choosing GET (again, assuming that’s correct).
  5. This is where things get tricky for me. I create a Header, and I’m typing Authorization as the Name, and pasting the API Key as the Value.

I leave everything else alone and run a test. It comes back successful and it brings back a TON of info which seems great. But I feel like I need to be using the Input fields and maybe defining something in the Body? So I tried entering Item Name and Item Price under the Input section just to test it out. Here’s what the screen looks like:

Once I created the action, I clicked it and it displays the two new input fields I created. I go to the magic text to associate the Item Name and Item Price to the Item Name and Item Price I created in my Database Collections under Inventory Items, but I don’t see the option to add them. I only see the option to add something from my Users and Home Improvement Stores Collections. I did add a relationship between Inventory Items and Home Improvement Stores, so I thought that was weird.

Sorry for the drawn out explanation, but I’m really hoping someone can read through this and have enough info to walk me through what I’m doing wrong.

Thanks!
Manny

Hi Manny,

There might be a couple of issues here. I think you need to add this as an external collection, rather than a custom action. Custom actions can’t be used to display lists.

The magic text inputs are your search criteria. You could get these from user input fields, or logged in user data, or available data on that page. But for this use case, I think you need to switch this to be an external collection.

Hey thanks for getting back to me! So I actually was just looking at that while waiting for a response. So I’m assuming I would want to use GET ALL in this case? If so, what would I use for the Results Key?

The results key (if necessary at all) depends on the structure of the API response. You use it to access nested data, so Adalo knows what to return a list of. Some APIs would return a response with different nested lists and objects and Adalo wouldn’t know which data it’s supposed to be looking at. So the results key allows you to tell Adalo which part of the response to use. If you show the full API response, I might be able to suggest which results key it is.

I’m not sure how to get that for you. Here is where I’m accessing the API information:

https://app.bigboxapi.com/playground

Are you able to look in there and figure it out?

Your custom action you worked on previously would have returned the response already when testing, you just click ‘see full response’ after custom action setup. If you go back and test that custom action, click see full response at the bottom, and can screenshot or copy and paste it here.

It comes back with a TON of info so I wouldn’t be able to fit it all. Here’s the first part of it though:

{
“request_info”: {
“success”: true,
“credits_used”: 57,
“credits_remaining”: 43,
“credits_used_this_request”: 1
},
“request_parameters”: {
“type”: “search”,
“search_term”: “lawn mower”
},
“request_metadata”: {
“created_at”: “2023-07-08T03:18:20.304Z”,
“processed_at”: “2023-07-08T03:18:40.390Z”,
“total_time_taken”: 20.09,
“homedepot_url”: “https://www.homedepot.com/s/lawn%20mower?NCNI-5
},
“search_results”: [
{
“position”: 1,
“product”: {
“title”: “RYOBI 40V HP Brushless 20 in. Cordless Electric Battery Walk Behind Self-Propelled Mower with 6.0 Ah Battery and Charger”,
“link”: “https://www.homedepot.com/p/RYOBI-40V-HP-Brushless-20-in-Cordless-Electric-Battery-Walk-Behind-Self-Propelled-Mower-with-6-0-Ah-Battery-and-Charger-RY401180/317061072”,
“is_bestseller”: true,
“is_top_rated”: true,
“brand”: “RYOBI”,
“item_id”: “317061072”,
“store_sku”: “1006431849”,
“model_number”: “RY401180”,
“images”: [
https://images.thdstatic.com/productImages/495b2088-21d2-4785-8508-be05c291b134/svn/ryobi-electric-self-propelled-lawn-mowers-ry401180-64_1000.jpg”,
https://images.thdstatic.com/productImages/ca4810fa-493c-4137-9715-7f6ef7f7f112/svn/ryobi-electric-self-propelled-lawn-mowers-ry401180-e4_1000.jpg
],
“primary_image”: “https://images.thdstatic.com/productImages/495b2088-21d2-4785-8508-be05c291b134/svn/ryobi-electric-self-propelled-lawn-mowers-ry401180-64_1000.jpg”,
“rating”: 4.4,
“ratings_total”: 1658,
“collection”: {
“id”: “Family-308879048”,
“name”: “Family-308879048”,
“link”: “https://www.homedepot.com/collection/Outdoors/RYOBI-40-Volt-Collection/Family-308879048?omsid=317061072
},
“features”: [
{
“name”: “Cutting Width (in.)”,
“value”: “20 inches”
},
{
“name”: “Voltage (v)”,
“value”: “40v”
},
{
“name”: “Size of Yard”,
“value”: “1/4 - 1/2 Acre”
},
{
“name”: “Battery Run Time (min.)”,
“value”: “42”
},
{
“name”: “Charger Included”,
“value”: “Charger Included”
}
]
},
“fulfillment”: {
“pickup”: true,
“ship_to_store”: false,
“ship_to_home”: true,
“scheduled_delivery”: true,
“pickup_info”: {
“store_id”: “121”,
“store_state”: “Cumberland”,
“store_name”: “GA”,
“in_stock”: false,
“stock_level”: 0
},
“ship_to_home_info”: {
“store_id”: “8119”,
“in_stock”: true,
“stock_level”: 9999
},
“scheduled_delivery_info”: {
“store_id”: “121”,
“store_state”: “Cumberland”,
“store_name”: “GA”,
“in_stock”: false,
“stock_level”: 12,
“delivery_date_name”: “Tomorrow”
}
},
“offers”: {
“primary”: {
“price”: 449,
“regular_price”: 499,
“symbol”: “$”,
“currency”: “USD”
}
}
},

Try the results key search_results

Ok. I’m going to try that tomorrow. Also, do you know how I can get it to show me results for ALL items? Right now, it’s defaulting the search term to ‘lawn mower’, so I’d expect my search results to only include that. But if I leave the search term field empty, it won’t run the API request. I tried typing ALL, but I don’t think that worked.

That’s specific to the api you are using. They might have another endpoint for returning all results. Or it might not like that there’s a query parameter to filter it, but it’s empty.

Hey it worked! Thanks so much for getting me going on this. Had me stumped for quite a while. The next step I’d like to take now would be to get a list of inventory from each store depending on which one the user selects. Right now, the API brings in the inventory from just one store.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.