Retrieve product by SKU

Hello,

is it possible to search for a product by SKU using the REST API?

Best,
Alessandro

Not with the REST api. The standard api does have the ability to query the table of products by sku though.

How do you retrieve a product by SKU with RPC? the docs only specify getting product inventory and nothing about SKU or even ID.

The reason I need to query by SKU is because when I imported by products the PrimaryForeignKey was ignored and an autoincrement id was set instead. After deleting and re importing multiple times I see that the deleted product IDs are still in the system, but new ones are auto incremented on top of the deleted ids.

We have thousands of product IDs, but only want to import a certain few, so the API really doesnt give me any option to retrieve a product at the moment.

You can use DataService.query to query the Product table and filter by sku. See the table schema docs here https://developer.infusionsoft.com/docs/table-schema

I am not sure where you are going with the import stuff. Were you expecting the app to use an external id for the primary key? We don’t delete products we just basically hide them since they are most likely referenced by OrderItems and InvoiceItems. When you say you “only want to import a certain few” do you mean into Infusionsoft or into your other system?

You can use DataService.query to query the Product table and filter by sku . See the table schema docs here https://developer.infusionsoft.com/docs/table-schema

Thanks for the pointer there. Would you have an example on how to use the table schema with RPC or am I missing something? I am struggling with the API docs and the table schema really doesn’t give any clue how you use it.

When the import function referenced a PrimaryForiegnKey I assumed I could use my ID in my system and sync them on my side with just the ID. It was working for a while. The first import used my IDs, but now that I deleted them and remimported them its only using available IDs. It’s my understanding that I will sync my third party contacts, orders and products from mine to infuisionsoft so that we can track the campaigns.

This is a brand new account so we do not have any order or invoices yet. I am just trying to figure out how it all works for now.

How would you advise to sync products from my website and infusions products?

I’d really not like to change my IDs on my systems as they are used in other systems old and new.

Ok I found the out how to use the table-schema by googling it. It redirected me back to this forum and then to this page https://developer.infusionsoft.com/docs/xml-rpc/#data-query-a-data-table

I have to say the docs are not very helpful to someone who doesn’t know anything about the Infusionsoft API.

Just a little link at the top of the page of the table-schema would of had me doing this yesterday morning.

Thanks for the pointer Brad. Lets hope I can have a more productive day today!

Sorry when you were referencing the RPC calls I assumed you were already looking at those docs, since they are under the main Documentation Menu. Just as disclaimer we are trying to deprecate XML/RPC. I will add the query by sku as a feature request to the REST API for products.

Is this a Keap or Infusionsoft app? I want to test some things out.

Thanks for the feature request. I am solely relying on RPC at the moment because I cannot get the REST api to work at all. The errors I get are so nondescript. I have given the REST API a few tries, but RPC is doing everything for me now. I also noticed 3 year old post stating the RPC will be deprecated. However the Rest API from what I have seen on the forums still cannot do everything that RPC can do.

It’s Infusion I believe. But the fact that I end up on keap.com when signing in is confusing to what I am actually using? Are they not the same company but a changed name?

We did rebrand a little over a year ago, but we kept our top tier product named Infusionsoft by Keap.

I would be very interested knowing what errors you are receiving from the REST API and what you are considering nondescript, so we can address them. One of the goals of the REST API is to provide much better error responses than the XML/RPC API.

I know we have been saying the XML/RPC has been deprecated for years, which it has. We have had an off and on again effort over the last couple years to get parity in the REST API. Not everything will be available in REST, for example super low usage APIs or things we want to address in a completely different way like Saved Searches. Things like Saved Searches via the API cause us lots of performance problems so we have plans to get at that data in different ways than straight queries on the database.

Unfortunately I cannot remember the errors I received as I was under some pressure to get it working which is why I used RPC.

Nondescript as in not fully explaining documentation or outright out of date docs. for instance when I first imported my product list via CSV I was asked to fill in PrimaryForiegnKey from the sample CSV for the product which I assumed would sync my list with that in Infusion. After chasing my tail for about 3 days I gave upon with that because my product IDs would not import atall and I had no way to truncate the DB.
About a week later after setting up a ticket with Infusionsoft I get an email from you guys stating that the “PrimaryForiegnKey” isn’t even mapped and should not be used in the sample CSV or the import, but there it is when you import a product. That cost me days of frustration and also I had to recode because you guys gave me the impression I could code my IDs into your system.

Hello Ben,

My name is Nosko and I am on the Customer Support Team here at Keap.

After some review I see what you mean. You enter your own key and after the import the system creates its own id number and assigns it. I hope I am understanding the issue here.

Unfortunately you can not import a product with a custom id number. The system needs to create and assign its own value. I apologize that the example file caused confusion. I dont know why that column is in the file as it doesnt actually map to anything. That column would be used in the process of “modify existing records import” Its a different kind of import where instead of creating you are mapping to an existing id number and updating the details of that id number.

Please let me know if there is anything else we can assist with.

You can use your id’s BUT IS isn’t going to key off them…you have to use a custom field for custom id’s and then check if exists by that custom field and then create/update based on that.

Functionally it’s the same and takes only one additional api call. I use this approach with clients and custom data/id’s all the time.