Web API Picture return 404

Monday, November 25, 2024 10:39:29 PM
  • Posted: Wednesday, November 11, 2020 5:58 AM
  • 34
Manually added 10 products with pictures via admin panel to test out Web API calls.
Using Postman, https://domain/odata/product returns 200 OK and data was listed.
However, https://domain/odata/picture returns 404 Not Found

Calling other API like https://domain/odata/vendor returns 200 OK, with empty data set.
The images display correctly on the web portal.
What could have gone wrong?
0
  • Posted: Wednesday, November 11, 2020 7:41 PM
  • Team
  • 152
Hello,

API does not allow to list all pictures, you can get only by Id.

Best Regards
Krzysztof
0
  • Posted: Wednesday, November 11, 2020 10:43 PM
  • 34
Hi,

If there are 500 images and 10 products records, how to clean up 480 images that are not associated to any product?
I was thinking of getting all images ID and run thru existing products ID to purge the unwanted picture IDs.

Thanks.
0
  • Posted: Thursday, November 12, 2020 1:17 AM
  • 34
In addition, I attempted to update the price of a product via API https://domain/odata/product('5fac8241b75dfa1e7a886597') using PATCH with body { "Price": 1.25 } and content-type set to application/json at header.

The response was 200 OK, however the price of the product was not update when view at the portal.
How can I trace what could have gone wrong?
0
  • Posted: Thursday, November 12, 2020 11:53 AM
  • 1
Hello,

In the case of pictures, it expected behavior. There are too many dependencies, pictures can also be related to manufacturer, vendor, category, slider, not only to product picture. So we've decided to don't implement it.

In the case of the problem with the PATCH request, it looks like it's a bug. We will investigate and fix it. Thanks for reporting.
0
  • Posted: Thursday, November 12, 2020 10:51 PM
  • 34
Hi,

Understood. In that case, could the API https://domain/odata/picture return a list of all picture ID instead.
In this way, maintenance of pictures could be run by going thru vendor/manufacturer/etc picture ID list and finalizing a list of orphaned/unlinked picture ID for explicit deletion. Thus, the size of picture database could be kept at bay and daily database backup time could be estimated.

May I know how can I get the bug fixed version of GrandNode with the PATCH API on product issue rectified?
0
  • Posted: Friday, November 13, 2020 2:21 PM
  • 953
Clarence,

The bug has been fixed today, you can check it here. And implement the simple fix in your copy of GrandNode.

In the case of GET request for All pictures, we don't have plans to implement it for now.
Best regards,
Patryk

GrandNode Team
0
  • Posted: Saturday, November 14, 2020 2:11 AM
  • 34
Hi Patryk,

List all pictures' ID only, not the pictures, i.e. Base64 data.
This would facilitate in the database size maintenance to rid unlinked pictures.

Regards,
Clarence
0
  • Posted: Saturday, November 14, 2020 3:30 AM
  • 34
Hi Patryk,

GrandApi.dll was compiled according to suggested patch.

Using Postman, updating the price of a product via API https://domain/odata/product('5fac8241b75dfa1e7a886597') using PATCH with body { "Price": 1.25 } and content-type set to application/json at header returns error 500 Internal Server Error

The body is : Value cannot be null (Parameter 'patchDoc')
Any suggestion to where to specify the 'patchDoc' ?

Regards,
Clarence
0
  • Posted: Monday, November 16, 2020 7:26 AM
  • 953
Hi Clarence,

Please apologize, I've forgot to mention that the body of the request should be different.

According to the good practices of .NET Core, we've modified the PATCH request, and it should looks like this:
[
  {
    "path": "Name",    / Name of the field
    "op": "replace",
    "value": "string"    / Value of the field
  }
]
Best regards,
Patryk

GrandNode Team
0
back to top
Filters