Profile: comichael

Statistics
Avatar
  • 14

We are setting up a multi-store solution where each store can have custom product prices.

In Admin, we are able to handle this by defining a Tier Price for each store, which is great.

However, I can not find this option in the API.  Is it possible? (Or will it be?)

Monday, April 22, 2019 8:17 AM

Thanks a lot, we'll upgrade and add this setting.

Could you explain very short what's done "behind the scenes" here, compared to previous versions?

Monday, April 15, 2019 8:14 PM

We have followed the steps in the install guide, but still get errors when uploading product images.

We got this to work on our Win/IIS setup, but not Linux/Docker. I don't have direct access  to the Linux server, but the CTO has confirmed that access rights are set to RW.

From log in /Admin/Log/List:

Access denied to user #x@y.com 'x@y.com' on /Admin/Picture/AsyncUpload

Any suggestions are appreciated!

Monday, April 15, 2019 7:07 PM

Thx for your reply (and sorry about failed image formatting above).

We're using MongoExpress and I have confirmed that data is not updated in the database, even if HTTP gives 200/OK.  

Also checked this product in the front store UI (no category assigned).

We were able to update product name for product via API, so DB connection is to be OK.

There is always an explaination for issues like this.  Please check what "states" could give 200/OK without updating the DB.

We will try to set up the API as a local api test sandbox as mentioned, but I guess this will take some time.

Saturday, March 30, 2019 5:06 AM

Hi

We are still working on the API. I have struggled with this issue for some time now and realize I might just ask for help.

Problem is assigning category to product . This gives 200/OK but is not updated in MongoDB.

Do you see what the problem might be?

Testing for this product (ID 5c9c2e851c149e000188462f)

[url=https://ibb.co/fDTf7pZ][/url]


...and this category (ID 5c6697123945712d04312c17)

[url=https://ibb.co/Yykk5rk][/url]

Fiddler POST request gives 200 OK

[url=https://ibb.co/Tc7CK1x][/url]

...but DB is not updated

[url=https://ibb.co/fn88zqx][/url]


Can you see the problem?
Will appreciate any help on this!

Also, some suggestions
1) Article / guide on how to set up sandbox for testing/debugging API requests
2) Possible to define relations to Categories/Pictures etc in "main" JSON for Insert/Update product (I understand it's not possible today)

Thursday, March 28, 2019 8:57 AM

Hi, thanks a lot for helping to debug this.

I've been reading up on this, and it seems that both the trailing "Z" and "+01:00" are valid time formats according to ISO 8601. (Z means UTC and +01:00 means UTC plus 1 hour).

What is *not* valid however, is the commas in the dates that I have tried to send.

I'm not sure where/when/why the dots in my test have been replaced by commas (as in "2019-03-16T06,03,28.991Z), but it seems that dates from GN API has the correct format.

Sorry for the inconvenience as this apparently is not a bug after all.

Saturday, March 23, 2019 12:48 AM

[continued]
...

"PreOrderAvailabilityStartDateTimeUtc": null,
  "CallForPrice": false,
  "Price": 727,
  "OldPrice": 830,
  "CatalogPrice": 830,
  "ProductCost": 0,
  "CustomerEntersPrice": false,
  "MinimumCustomerEnteredPrice": 0,
  "MaximumCustomerEnteredPrice": 0,
  "BasepriceEnabled": false,
  "BasepriceAmount": 0,
  "BasepriceUnitId": "5c66970e3945712d0430e819",
  "BasepriceBaseAmount": 0,
  "BasepriceBaseUnitId": "5c66970e3945712d0430e819",
  "UnitId": null,
  "MarkAsNew": false,
  "MarkAsNewStartDateTimeUtc": null,
  "MarkAsNewEndDateTimeUtc": null,
  "Weight": 2,
  "Length": 2,
  "Width": 2,
  "Height": 2,
  "AvailableStartDateTimeUtc": null,
  "AvailableEndDateTimeUtc": null,
  "StartPrice": 0,
  "AuctionEnded": false,
  "DisplayOrder": 0,
  "DisplayOrderCategory": 0,
  "DisplayOrderManufacturer": 0,
  "Published": true,
  "CreatedOnUtc": "2019-02-15T10,40,22.78Z",
  "UpdatedOnUtc": "2019-03-16T06,03,28.991Z",
  "Sold": 4,
  "Viewed": 10,
  "OnSale": 0,
  "Flag": null,
  "Id": "5c6697163945712d04312e7a",
  "Categories": [],
  "Manufacturers": [],
  "Pictures": [],
  "SpecificationAttribute": [],
  "TierPrices": [],
  "WarehouseInventory": [],
  "AttributeMappings": [],
  "AttributeCombinations": []
}


===========================================
RESULT (RAW)
===========================================

HTTP/1.1 400 Bad Request
Date: Thu, 21 Mar 2019 15:47:13 GMT
Content-Type: application/json; odata.metadata=minimal; odata.streaming=true; charset=utf-8
Server: Kestrel
Transfer-Encoding: chunked
X-Powered-By: GrandNode
OData-Version: 4.0
X-Content-Type-Options: nosniff

77
{"error":{"code":"","message":"The input was not valid.","details":[{"code":"","message":"The input was not valid."}]}}
0

Thursday, March 21, 2019 5:04 PM

Thx for feedback.

OK, so we’re trying the simple solution first: Update using POST to our store API http://[OUR_DOMAIN]/odata/product , with similar JSON as received from GET.

However, the POST gives a 400 Bad Request result. We have not implemented SSL yet so just using http.

I have looked at the API source code and understand that the product’s Id should be specified in the JSON, and not be part of the url, and that it needs to be POST and not PUT.

Authorization is OK using Bearer, and have checked that JSON syntax is valid. I have tried to “wrap” the JSON in different ways with curly braces and labels, but have not been able to get this to work.

I’m pasting the raw request and response from Fiddler below. Any suggestions that can help us solve this are appreciated.

Note: I have not included the contents of the Categories / Manufacturers arrays (etc) in the bottom in the request.



[code]

===========================================
REQUEST (RAW)
===========================================
POST http://[----SNIP---].no/odata/product HTTP/1.1
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6I[----SNIP----]gFN-i7WaIrY6sxLieM
Content-Type: application/json; charset=utf-8
Content-Length: 3977
Host: [----SNIP---].no

{
  "ProductType": "SimpleProduct",
  "ParentGroupedProductId": null,
  "VisibleIndividually": true,
  "Name": "CONTINENTALLLLL PREMIUMCONTACT 5",
  "SeName": "fahrenheit-451-by-ray-bradbury",
  "ShortDescription": "TESTVINNER!",
  "FullDescription": "<h4>CONTINENTAL CONTIPREMIUMCONTACT5 </h4>\r\n<ul>\r\n<li>2. plass i ADAC sommerdekktest 2018</li>\r\n<li>Testvinner GTÜ sommerdekktest 2017</li>\r\n<li>Andreplass Aftonbladets sommerdekktest 2017</li>\r\n<li>Testvinner ADAC sommerdekktest 2016</li>\r\n<li>Tredjeplass på sommerdekktestet til NAF 2016</li>\r\n</ul>",
  "AdminComment": null,
  "ProductTemplateId": "5c6697123945712d04312bdf",
  "VendorId": null,
  "ShowOnHomePage": false,
  "MetaKeywords": null,
  "MetaDescription": null,
  "MetaTitle": null,
  "AllowCustomerReviews": true,
  "ApprovedRatingSum": 4,
  "NotApprovedRatingSum": 0,
  "ApprovedTotalReviews": 1,
  "NotApprovedTotalReviews": 0,
  "ExternalId": null,
  "Sku": "TTPAH45-0S11S",
  "ManufacturerPartNumber": null,
  "Gtin": null,
  "IsGiftCard": false,
  "GiftCardType": "Virtual",
  "OverriddenGiftCardAmount": null,
  "RequireOtherProducts": false,
  "RequiredProductIds": null,
  "AutomaticallyAddRequiredProducts": false,
  "IsDownload": false,
  "DownloadId": null,
  "UnlimitedDownloads": false,
  "DownloadActivationType": "WhenOrderIsPaid",
  "MaxNumberOfDownloads": 0,
  "DownloadExpirationDays": null,
  "HasSampleDownload": false,
  "SampleDownloadId": null,
  "HasUserAgreement": false,
  "UserAgreementText": null,
  "IsRecurring": false,
  "RecurringCycleLength": 0,
  "RecurringTotalCycles": 0,
  "RecurringCyclePeriod": "Days",
  "IncBothDate": false,
  "Interval": 0,
  "IntervalUnitType": "Minute",
  "IsShipEnabled": true,
  "IsFreeShipping": true,
  "ShipSeparately": false,
  "AdditionalShippingCharge": 0,
  "DeliveryDateId": null,
  "IsTaxExempt": false,
  "TaxCategoryId": "5c66970e3945712d0430e81e",
  "IsTelecommunicationsOrBroadcastingOrElectronicServices": false,
  "UseMultipleWarehouses": false,
  "WarehouseId": null,
  "StockQuantity": 9996,
  "ManageInventoryMethod": "ManageStock",
  "DisplayStockAvailability": true,
  "DisplayStockQuantity": false,
  "MinStockQuantity": 0,
  "LowStock": false,
  "LowStockActivity": "DisableBuyButton",
  "NotifyAdminForQuantityBelow": 1,
  "BackorderMode": "NoBackorders",
  "AllowBackInStockSubscriptions": false,
  "OrderMinimumQuantity": 1,
  "OrderMaximumQuantity": 10000,
  "AllowedQuantities": null,
  "AllowAddingOnlyExistingAttributeCombinations": false,
  "NotReturnable": false,
  "DisableBuyButton": false,
  "DisableWishlistButton": false,
  "AvailableForPreOrder": false,
  "PreOrd

Thursday, March 21, 2019 5:02 PM

What is the minimal JSON neccessary for updating a product via the API?

The documentation states:

you must enter all fields that exist and enter the ID of product which you want update

Is the solution to load the existing product object from the API and use that for modifications?

Tuesday, March 19, 2019 6:57 PM

If so, what are these differences, and which modifications would be needed in code?

Example: Payment plugin is used in nopCommerce, must be able to use in GrandNode implementation.

Tuesday, March 5, 2019 1:04 AM