Extended Web API - CreateProductPicture 404

Monday, November 25, 2024 3:51:03 PM
  • Posted: Friday, October 21, 2022 2:01 AM
  • 34
An instance of GrandNode v4.9 was deployed in 2020 and I'm tasked to test migration for Extended Web API for GrandNode v2.0.
Both Product and image creation was fine, i.e. records appeared in database. However calling POST /odata/product('id')/CreateProductPicture to associate picture to product resulted in 404 (Not Found).

The body of the POST is JSON data { 'PictureId': '6351fba61b22e19aeb692bc2', 'MimeType': 'image/webp' }
Has GrandNode team tested Extended Web API v2.0? The plugin was working for v4.9.
0
  • Posted: Friday, October 21, 2022 2:15 AM
  • 34
The same goes for POST method UpdateProductPicture, resulted in 404.
The Extended Web API version installed was 2.0.2
0
  • Posted: Friday, October 21, 2022 2:44 PM
  • Team
  • 152
Hi,
Plugin does not cover support for picture controller.
This features are available without plugin.
More information you can find here: https://github.com/grandnode/grandnode2/blob/master/src/API/Grand.Api/Controllers/OData/PictureController.cs
0
  • Posted: Saturday, October 22, 2022 2:35 AM
  • 34
Hi Krzysztof,

So the documentation Backend Web API--> Operations with pictures  is no longer valid?
Then, what's the URL equivalent for /odata/picture? i.e. how do I CRUD pictures using API calls?
0
  • Posted: Saturday, October 22, 2022 3:21 AM
  • 34
I've also tested API call like /odata/product('6353603d246dad1383ffc437')/CreateProductCategory which also resulted in 404.
Is this method still available in GrandNode 2 Extended Web API?
0
  • Posted: Saturday, October 22, 2022 3:35 AM
  • 34
I spend a few hours just to go through methods for operations on Product using Postman.

Many methods resulted in 404, like GET /odata/product('id'), PATCH /odata/product('id'), DELETE /odata/product('id'), POST /odata/product('id')/UpdateStock, POST /odata/product('id')/CreateProductCategory, POST /odata/product('id')CreateProductPicture.

Are the methods name correct in GrandNode2? These are methods that used to work in v4.9.
How can I list the available methods in Extended Web API v2.02 as the documentation seem to be a direct copy from v4.9.
I suppose the migration is quick and underestimated the time required to trial and error.
0
  • Posted: Sunday, October 23, 2022 2:37 PM
  • Team
  • 152
Thanks for info, it looks like documentation is outdated. We will update it ASAP.
You have access to the swagger, so you can check everything.
0
  • Posted: Sunday, October 23, 2022 9:46 PM
  • 34
Hi Krzysztof,

Can I have the signature for methods used to CRUD product? i.e. Update Product Picture etc?
I need to test out the basics on the Extended Web API to estimate the migration time needed to update GrandNode I to GrandNode II quickly.
Thanks.
0
  • Posted: Monday, October 24, 2022 4:49 PM
  • Team
  • 152
Hi,
I've just tested Create new products and works well.
About pictures:
1. First request is for create picture:
POST: https://localhost:44350/odata/picture/
and sample body:
{
  "id": "",
  "pictureBinary": "iVBOR..", //base64
  "mimeType": "png",
  "seoFilename": "string",
  "altAttribute": "string",
  "titleAttribute": "string",
  "reference": 40, //this enum = 40 is product -- it's recommended
  "objectId": "633da317476b0157393a425b", //id product - it's recommended
  "style": "string",
  "extraField": "",
  "isNew": true
}
reference and objectId - will be used to auto map (in the next release of application)
2. Next request is mapping product with picture
POST: https://localhost:44350/odata/product/(633da317476b0157393a425b)/CreateProductPicture
Body:
{
  "PictureId": "6356bf1e0b711622d34c5502",
  "DisplayOrder": 10
}

633da317476b0157393a425b - productId

and that's it
0
  • Posted: Friday, October 28, 2022 5:55 AM
  • 34
Let's start with a simple example.
Using Postman, I create a new product using GET and got the id : 635b6d4c246dad138307b717

When I tried to delete the above product using DELETE command, I get a 404 Not Found Error
https://simplex.sgvmart.com/odata/product('635b6d4c246dad138307b717')

I can send the API key separately to your email if you need to test on the above URL.
0
back to top
Filters