Skip to content
This repository has been archived by the owner on Nov 30, 2022. It is now read-only.

rest api #1231

Open
unplugged216 opened this issue Oct 7, 2022 · 6 comments
Open

rest api #1231

unplugged216 opened this issue Oct 7, 2022 · 6 comments
Labels
help-wanted Contributor help would be nice! needs-info More information required unconfirmed Unconfirmed yet if it is a true bug/issue.

Comments

@unplugged216
Copy link
Contributor

For bug reporting only! If you're posting a feature request or discussion, please ignore.

Expected Behavior

When following the documented method for querying customer information in a shop, I am expecting to get a single result back.

$req = $shop->api()->rest('GET','/admin/api/customers/search.json', ['query' => 'email:[email protected]'])['body'];

Current Behavior

When running the above query, it is as if the query is not actually run and instead all results are returned. I have confirmed a single customer exists with that email. Yet it returns 50 results not just the single customer.

Failure Information

N/A

Steps to Reproduce

Run the above query using an email you know exists

@unplugged216
Copy link
Contributor Author

Well, after firmly planting my face into the keyboard, repeatedly, I determined the issue. An undocumented thingy....

In the Shopify dev docs and here in the wiki, it only assumes a customer search needs one query parameter. Well, thats false it appears. You must include 'limit' of 1.... I am working to confirm this but so far thats what it seems.

@Kyon147
Copy link
Collaborator

Kyon147 commented Oct 11, 2022

Glad you found the solution @unplugged216 - I'm going to close this ticket now.

@Kyon147 Kyon147 closed this as completed Oct 11, 2022
@pramod-praella
Copy link

hey @unplugged216 how you resolved this? as per your conversation i added a limit but still getting all records

@unplugged216
Copy link
Contributor Author

unplugged216 commented Oct 12, 2022

hey @unplugged216 how you resolved this? as per your conversation i added a limit but still getting all records

Hey @Pramod-HulkApps!

Here is an example, demonstrating what did not work and what worked for me.

What did not work
$shop->api()->rest('GET','/admin/api/2022-10/products.json', [ 'product_type' => 'Demo Type'])['body'];

This seemed to fix my issue
$shop->api()->rest('GET','/admin/api/2022-10/products.json', ['limit' => '250', 'product_type' => 'Demo Type'])['body'];

Please not I am also using the latest API. I opted in this call to set the API version manually instead of in ENV as I have noticed the ENV vars are not getting loaded consistently by the package.

@unplugged216
Copy link
Contributor Author

Glad you found the solution @unplugged216 - I'm going to close this ticket now.

@Kyon147 ,

I would recommend not closing this as my solution may only work for me. This is a documentation issue in this package. The package provides a wiki demonstration that does not work.... Closing an issue without resolve is unsettling for the project I feel.

@Kyon147
Copy link
Collaborator

Kyon147 commented Oct 13, 2022

Hi @unplugged216

Happy to reopen, that's my misunderstanding reading it as a API issue rather than a package one. I tried a direct api call, and don't see any issues - so there could be a bug in the shopify-basic-api package but would need some more investigation.

@Kyon147 Kyon147 reopened this Oct 13, 2022
@Kyon147 Kyon147 added unconfirmed Unconfirmed yet if it is a true bug/issue. help-wanted Contributor help would be nice! needs-info More information required labels Oct 13, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
help-wanted Contributor help would be nice! needs-info More information required unconfirmed Unconfirmed yet if it is a true bug/issue.
Projects
None yet
Development

No branches or pull requests

3 participants