Shopify / Shopify/shopify-api-php
Return created/updated objects
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 473
- Forks
- 193
- Avg merge
- 5h 8m
- Merged PRs (30d)
- 1
Description
Overview
The API itself will already return the full object if you do a create/update operation. However, the library swallows this response here:
https://github.com/Shopify/shopify-php-api/blob/0556edf274ceb83346533bd22b662d7622e58c66/src/Rest/Base.php#L60-L74
Solution
Adding return $response->getDecodedBody(); at the end of the function should suffice. Note that the saveAndUpdate function would also need to be updated, with return $this->save(true);. Implementation can be found in my fork: https://github.com/MagicLegend/shopify-php-api/commit/d43bc94601dabae8135cd1c35b5f4af3e1fdac23
Type
- New feature
- Changes to existing features
Motivation
What inspired this feature request? What problems were you facing?
I would like to verify the saved object myself, without needing to query the API again for data that was already returned in the first place. This also allows immediate access to the ID of the newly created object.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with src/Rest/Base.php at lines 60-74 and trace the saveAndUpdate function. Use the linked fork commit as a reference, then verify that create/update operations and saveAndUpdate expose the API's returned object, including access to the decoded response and newly created ID.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- api
- Issue type
- Feature
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100