Getting error "expected String to be a Integer"

Solved

Getting error "expected String to be a Integer"

robertovalentee
Visitor
2 1 0

Hi! When i try to get products info using RESTP API, i parse the last product id with parameter "since_id" to of course, get the other products since the mentioned one. When i execute the code, i get an error saying that "expected String to be a Integer". I've already checked the type of variable and of course, convert it to Int but I keep getting the same error.

Screenshot_2.png

 

And my code:

Screenshot_3.png

Accepted Solution (1)

robertovalentee
Visitor
2 1 0

This is an accepted solution.

Finally I found how to solve it!

 

Here is how (you need to parse another parameter to get method instead of apply the parameter in the "path"):

response = await shopifyClient.get("/products", { searchParams: { since_id: parseInt(finalResult[finalResult.length - 1].id) } });

View solution in original post

Reply 1 (1)

robertovalentee
Visitor
2 1 0

This is an accepted solution.

Finally I found how to solve it!

 

Here is how (you need to parse another parameter to get method instead of apply the parameter in the "path"):

response = await shopifyClient.get("/products", { searchParams: { since_id: parseInt(finalResult[finalResult.length - 1].id) } });