OroCommerce Forums

Covering OroCommerce topics, including community updates and company announcements.

Forums Forums OroCommerce Product post to oro commerce issue

This topic contains 1 reply, has 2 voices, and was last updated by  Andrey Yatsenko 4 years, 2 months ago.

Starting from March 1, 2020 the forum has been switched to the read-only mode. Please head to StackOverflow for support.

  • Creator
    Topic
  • #41315

    amrita.g
    Participant

    The packet I am posting to the product post URL(/admin/api/products) is below:
    {“data”:
    {
    “type”: “products”,
    “attributes”: {
    “sku”: “hero1234”,
    “status”: “enabled”,
    “variantFields”: [],
    “productType”: “simple”,
    “featured”: false,
    “newArrival”: true
    },
    “relationships”: {
    “owner”: {
    “data”: {
    “type”: “businessunits”,
    “id”: “1”
    }
    },
    “organization”: {
    “data”: {
    “type”: “organizations”,
    “id”: “1”
    }
    },
    “unitPrecisions”: {
    “data”: [
    {
    “type”: “productunitprecisions”,
    “id”: “2”
    }
    ]
    },
    “primaryUnitPrecision”: {
    “data”: {
    “type”: “productunitprecisions”,
    “id”: “2”
    }
    },
    “names”: {
    “data”: [
    {
    “type”: “localizedfallbackvalues”,
    “id”: “41”
    },
    {
    “type”: “localizedfallbackvalues”,
    “id”: “42”
    }
    ]
    },
    “descriptions”: {
    “data”: [
    {
    “type”: “localizedfallbackvalues”,
    “id”: “43”
    },
    {
    “type”: “localizedfallbackvalues”,
    “id”: “44”
    }
    ]
    },
    “variantLinks”: {
    “data”: []
    },
    “shortDescriptions”: {
    “data”: [
    {
    “type”: “localizedfallbackvalues”,
    “id”: “45”
    },
    {
    “type”: “localizedfallbackvalues”,
    “id”: “46”
    }
    ]
    },
    “images”: {
    “data”: []
    },
    “attributeFamily”: {
    “data”: {
    “type”: “attributefamilies”,
    “id”: “1”
    }
    },
    “brand”: {
    “data”: null
    },
    “slugPrototypes”: {
    “data”: [
    {
    “type”: “localizedfallbackvalues”,
    “id”: “47”
    },
    {
    “type”: “localizedfallbackvalues”,
    “id”: “48”
    }
    ]
    },
    “category”: {
    “data”: null
    },
    “pageTemplate”: {
    “data”: {
    “type”: “entityfieldfallbackvalues”,
    “id”: “41”
    }
    },
    “lowInventoryThreshold”: {
    “data”: {
    “type”: “entityfieldfallbackvalues”,
    “id”: “42”
    }
    },
    “taxCode”: {
    “data”: null
    },
    “manageInventory”: {
    “data”: {
    “type”: “entityfieldfallbackvalues”,
    “id”: “43”
    }
    },
    “highlightLowInventory”: {
    “data”: {
    “type”: “entityfieldfallbackvalues”,
    “id”: “44”
    }
    },
    “inventoryThreshold”: {
    “data”: {
    “type”: “entityfieldfallbackvalues”,
    “id”: “45”
    }
    },
    “minimumQuantityToOrder”: {
    “data”: {
    “type”: “entityfieldfallbackvalues”,
    “id”: “46”
    }
    },
    “maximumQuantityToOrder”: {
    “data”: {
    “type”: “entityfieldfallbackvalues”,
    “id”: “47”
    }
    },
    “decrementQuantity”: {
    “data”: {
    “type”: “entityfieldfallbackvalues”,
    “id”: “48”
    }
    },
    “backOrder”: {
    “data”: {
    “type”: “entityfieldfallbackvalues”,
    “id”: “49”
    }
    },
    “isUpcoming”: {
    “data”: {
    “type”: “entityfieldfallbackvalues”,
    “id”: “50”
    }
    },
    “metaTitles”: {
    “data”: [
    {
    “type”: “localizedfallbackvalues”,
    “id”: “49”
    },
    {
    “type”: “localizedfallbackvalues”,
    “id”: “50”
    }
    ]
    },
    “metaDescriptions”: {
    “data”: [
    {
    “type”: “localizedfallbackvalues”,
    “id”: “51”
    },
    {
    “type”: “localizedfallbackvalues”,
    “id”: “52”
    }
    ]
    },
    “metaKeywords”: {
    “data”: [
    {
    “type”: “localizedfallbackvalues”,
    “id”: “53”
    },
    {
    “type”: “localizedfallbackvalues”,
    “id”: “54”
    }
    ]
    },
    “inventory_status”: {
    “data”: {
    “type”: “prodinventorystatuses”,
    “id”: “in_stock”
    }
    }
    }
    },
    “included”: [{
    “type”: “entityfieldfallbackvalues”,
    “id”: “1”,
    “attributes”: {
    “fallback”: null,
    “scalarValue”: “short”,
    “arrayValue”: null
    }
    },
    {
    “type”: “entityfieldfallbackvalues”,
    “id”: “1”,
    “attributes”: {
    “fallback”: “systemConfig”,
    “scalarValue”: null,
    “arrayValue”: null
    }
    },
    {
    “type”: “entityfieldfallbackvalues”,
    “id”: “1”,
    “attributes”: {
    “fallback”: null,
    “scalarValue”: “31”,
    “arrayValue”: null
    }
    },
    {
    “type”: “entityfieldfallbackvalues”,
    “id”: “1”,
    “attributes”: {
    “fallback”: “systemConfig”,
    “scalarValue”: null,
    “arrayValue”: null
    }
    },
    {
    “type”: “entityfieldfallbackvalues”,
    “id”: “1”,
    “attributes”: {
    “fallback”: null,
    “scalarValue”: “41”,
    “arrayValue”: null
    }
    },
    {
    “type”: “entityfieldfallbackvalues”,
    “id”: “1”,
    “attributes”: {
    “fallback”: null,
    “scalarValue”: “1”,
    “arrayValue”: null
    }
    },
    {
    “type”: “entityfieldfallbackvalues”,
    “id”: “1”,
    “attributes”: {
    “fallback”: “systemConfig”,
    “scalarValue”: null,
    “arrayValue”: null
    }
    },

    {
    “type”: “localizedfallbackvalues”,
    “id”: “1”,
    “attributes”: {
    “fallback”: null,
    “string”: “Test product”,
    “text”: null
    },
    “relationships”: {
    “localization”: {
    “data”: {
    “type”: “localizations”,
    “id”: “6”
    }
    }
    }
    },
    {
    “type”: “localizedfallbackvalues”,
    “id”: “1”,
    “attributes”: {
    “fallback”: null,
    “string”: “Product in spanish”,
    “text”: null
    },
    “relationships”: {
    “localization”: {
    “data”: {
    “type”: “localizations”,
    “id”: “6”
    }
    }
    }
    },
    {
    “type”: “productunitprecisions”,
    “id”: “1”,
    “attributes”: {
    “precision”: “0”,
    “conversionRate”: “5”,
    “sell”: “1”
    },
    “relationships”: {
    “unit”: {
    “data”: {
    “type”: “productunits”,
    “id”: “each”
    }
    }
    }
    }
    ]
    }

    The error I am getting after posting the packet is:

    401 error

    alt-svc: clear
    cache-control: must-revalidate, no-cache, no-store, private
    content-type: application/json
    date: Wed, 22 Jan 2020 12:23:13 GMT
    expires: 0
    pragma: no-cache
    status: 401
    via: 1.1 google
    www-authenticate: WSSE realm=”Secured API”, profile=”UsernameToken”
    x-content-type-options: nosniff
    x-frame-options: SAMEORIGIN
    x-xss-protection: 1; mode=block

    I am signed in while posting the packet.
    Please suggest me the solution for this problem.
    Is there any wrong element that I am posting?
    Please provide me a correct packet to post product in oro commerce.

    Attachments:
    1. Capture-128x72
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)

The forum ‘OroCommerce’ is closed to new topics and replies.

Back to top