The property of the parent element is used first when making a request #75
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Whenever you want to make an API request to an URL that has a variable in it, e.g. deleting a product requires the sku of that product in the URL, you would go the a 'meta' file and add an operation that looks something like this:
<operation name="deleteProduct" dataType="product" type="delete" auth="adminOauth" url="/V1/products/{sku}" method="DELETE"> <contentType>application/json</contentType> </operation>
Adding
{sku}
to the url works if the entity that you want to delete is the only entity that has a property of that name, and there are no child entities associated with it that also have the property. In other words, if you want to create, for example, a bundle product, and be able to pass it the category and it's child products, like so:When you want to delete the product by calling
<deleteData createDataKey="createBundleProduct" stepKey="deleteBundleProduct"/>
, which refferences something like<operation name="deleteProductBundle" dataType="product_bundle" type="delete" auth="adminOauth" url="/V1/products/{sku}" method="DELETE"> <contentType>application/json</contentType> </operation>
, it will actually delete the last entity that was passed as a parameter which has the 'sku' property. In the example above that would be "createSimpleProduct3". This is not how it should work.The changes that I've made allows you to pick the entity that you want to make a refference to, when you want to call its property in the url. In order to delete a bundle product, one would add something like this in the metadata file:
Basically, instead of adding
{sku}
, one would add{product_bundle.sku}
, whereproduct_bundle
is the metadata entity type, to the url.Contribution checklist