W3Block Docs
  • 🚀Start here
    • Welcome to the Docs
    • Integrated Blockchains
  • 👨‍💻Dev Docs
    • API
      • Getting Started
      • Authentication
      • Commerce API services
        • Company Administration
          • Companies (Admin)
          • Assets (Admin)
          • Tags (Admin)
          • Products (Admin)
            • Order Rules (Admin)
          • Orders (Admin)
          • Faq (Admin)
          • Webhooks (Admin)
        • Products
        • Orders
        • Webhooks
        • Faq
        • Globals
      • Key API Services
        • Authentication
        • Companies
        • Tokens
          • Contracts
            • External Contacts
            • Royalty Eligible
          • Categories
            • Subcategories
          • Token Collections
            • Token Editions
          • Metadata
        • Blockchain
        • Cloudinary
        • Integration
          • Ecommerce
            • Associate Tokens
            • Hooks
        • Users
        • Vouchers
  • 📘Knowledge Base
    • First Steps
    • FAQ
    • Glossary
Powered by GitBook
On this page
  1. Dev Docs
  2. API
  3. Commerce API services
  4. Company Administration

Products (Admin)

PreviousTags (Admin)NextOrder Rules (Admin)

Last updated 2 years ago

Products are one of the main entities of commerce system. They are the entity which describes exactly what are the collection and tokens that are being sold in your e-commerce.

You can create products that represents one entire collection or even represents one unique and specific token from your collection/contract. If you have one product that contains more than one token, you can also specify different prices depending on the token that you want to sell. See more in .

Products can have some kind of rules which specify if some user can purchase it or not or even the maximum amount of tokens and the time period that some user can purchase the token. This is specified by .

Product Model (Example)
{
    "id": "6368dfb5-f48c-48b1-be13-dd413548a558",
    "createdAt": "2022-10-17T21:47:12.505Z",
    "updatedAt": "2022-10-17T22:04:00.373Z",
    "companyId": "010e92ea-d3af-40d9-a19e-a263fdfe6e92",
    "name": "Test",
    "description": "block",
    "images": [
        {
            "thumb": "https://dummyimage.com/200x200/fff/000",
            "original": "https://dummyimage.com/600x400/fff/000"
        }
    ],
    "prices": [
        {
            "amount": "1.20",
            "currencyId": "8c43ece8-99b0-4877-aed3-2170d2deb4bf",
            "currency": {
                "id": "8c43ece8-99b0-4877-aed3-2170d2deb4bf",
                "createdAt": "2022-09-02T11:23:53.575Z",
                "updatedAt": "2022-09-02T11:23:53.575Z",
                "name": "USD",
                "crypto": false,
                "symbol": "US$",
                "code": "USD"
            }
        }
    ],
    "distributionType": "random",
    "pricingType": "product",
    "contractAddress": "0x5478a7790e45bb08213b9d7384bf50f65fc0a667",
    "chainId": 80001,
    "startSaleAt": null,
    "endSaleAt": null,
    "status": "published",
    "draftData": {
        "range": "1",
        "quantity": 1,
        "keyCollectionId": "2e90e88b-7263-4cdc-a9dd-b7cdf3df4c91"
    },
    "slug": "string",
    "tags": [],
}

Service Methods

Creates a product inside the company

Rest API reference:

Lists all product of some company

Rest API reference:

Gets a company product by slug

Rest API reference:

Gets a company product by id

Rest API reference:

Updates some company product

You can't update tokens amount or collection from published product tokens. In a near future we are planning to offer that, but for a while, you will need to create a new one.

Rest API reference:

Publish a company product

Only published products can be purchased because is this endpoint that gets the permission of transfer and all other things about blockchain tokens informations.

Rest API reference:

👨‍💻
  • Service Methods
  • Creates a product inside the company
  • POST/admin/companies/{companyId}/products
  • Lists all product of some company
  • GET/admin/companies/{companyId}/products
  • Gets a company product by slug
  • GET/admin/companies/{companyId}/products/get-by-slug/{slug}
  • Gets a company product by id
  • GET/admin/companies/{companyId}/products/{productId}
  • Updates some company product
  • PATCH/admin/companies/{companyId}/products/{productId}
  • Publish a company product
  • PATCH/admin/companies/{companyId}/products/{productId}/publish
Public Products Page
product order rules
get
Authorizations
Path parameters
companyIdstringRequired
Query parameters
pagenumberOptionalDefault: 1
limitnumberOptionalDefault: 10
searchstringOptional
sortBystring · enumOptionalExample: createdAtPossible values:
orderBystring · enumOptionalPossible values:
sortByPriceCurrencyIdstring · uuid Optional
includeMetadatabooleanOptional

Includes first product token found metadata for each product. (Works good if you want to get some common NFT metadata attributes that is applied for all contract tokens)

Default: falseExample: false
tagIdsstring[]Optional
Responses
200Success
401
User doesn't have any of the expected roles: administrator, admin, superAdmin, integration
get

No content

get
Authorizations
Path parameters
companyIdstringRequired
slugstringRequired
Responses
200Success
401
User doesn't have any of the expected roles: administrator, admin, superAdmin, integration
get

No content

get
Authorizations
Path parameters
productIdstringRequired
companyIdstringRequired
Responses
200Success
401
User doesn't have any of the expected roles: administrator, admin, superAdmin, integration
get

No content

patch
Authorizations
Path parameters
productIdstringRequired
companyIdstringRequired
Responses
200Success
401
User doesn't have any of the expected roles: administrator, admin, superAdmin, integration
patch

No content

post
Authorizations
Path parameters
companyIdstringRequired
Body
namestringRequiredExample: W3Block Product
descriptionstringRequiredExample: My Description
distributionTypestring · enumRequiredExample: randomPossible values:
pricingTypestring · enumRequiredExample: productPossible values:
startSaleAtstring · date-timeOptional
endSaleAtstring · date-timeOptional
slugstringOptional
htmlContentobjectOptionalExample: <b>block</b>
onDemandMintEnabledbooleanOptionalDefault: trueExample: true
termsobject[] | nullableOptional
relevancenumberOptionalDefault: 0Example: 0
Responses
201Success
application/json
Responseobject
401
User doesn't have any of the expected roles: administrator, admin, superAdmin, integration
post
POST /admin/companies/{companyId}/products HTTP/1.1
Host: commerce.w3block.io
Authorization: Bearer JWT
Content-Type: application/json
Accept: */*
Content-Length: 1008

{
  "tags": [
    "7ca74ed3-93ff-4df9-b8a0-8308c590174b"
  ],
  "name": "W3Block Product",
  "description": "My Description",
  "images": [
    {
      "assetId": "123e4567-e89b-12d3-a456-426614174000",
      "variants": [
        {
          "keyLabel": "text",
          "keyValue": "text"
        }
      ]
    }
  ],
  "prices": [
    {
      "currencyId": "65fe1119-6ec0-4b78-8d30-cb989914bdcb",
      "amount": "0.01"
    }
  ],
  "distributionType": "random",
  "pricingType": "product",
  "startSaleAt": null,
  "endSaleAt": null,
  "draftData": {
    "keyCollectionId": null,
    "range": null
  },
  "slug": "text",
  "htmlContent": "<b>block</b>",
  "onDemandMintEnabled": true,
  "requirements": {
    "companyId": "123e4567-e89b-12d3-a456-426614174000",
    "keyCollectionId": "123e4567-e89b-12d3-a456-426614174000",
    "productId": "123e4567-e89b-12d3-a456-426614174000",
    "requirementCTALabel": "text",
    "requirementDescription": "text",
    "requirementModalContent": "text",
    "requireKycContext": {
      "slug": "text"
    }
  },
  "terms": null,
  "relevance": 0,
  "settings": {
    "passShareCodeConfig": {
      "dataFields": [
        {
          "name": "text",
          "type": "text",
          "label": "text",
          "required": true
        }
      ],
      "enabled": true
    },
    "acceptMultipleCurrenciesPurchase": true
  }
}
{}
GET /admin/companies/{companyId}/products HTTP/1.1
Host: commerce.w3block.io
Authorization: Bearer JWT
Accept: */*
GET /admin/companies/{companyId}/products/get-by-slug/{slug} HTTP/1.1
Host: commerce.w3block.io
Authorization: Bearer JWT
Accept: */*
GET /admin/companies/{companyId}/products/{productId} HTTP/1.1
Host: commerce.w3block.io
Authorization: Bearer JWT
Accept: */*
patch
Authorizations
Path parameters
productIdstringRequired
companyIdstringRequired
Body
namestringOptionalExample: W3Block Product
descriptionstringOptionalExample: My Description
distributionTypestring · enumOptionalExample: randomPossible values:
pricingTypestring · enumOptionalExample: productPossible values:
startSaleAtstring · date-timeOptional
endSaleAtstring · date-timeOptional
slugstringOptional
htmlContentobjectOptionalExample: <b>block</b>
onDemandMintEnabledbooleanOptionalDefault: trueExample: true
termsobject[] | nullableOptional
relevancenumberOptionalDefault: 0Example: 0
Responses
200Success
401
User doesn't have any of the expected roles: administrator, admin, superAdmin, integration
patch
PATCH /admin/companies/{companyId}/products/{productId} HTTP/1.1
Host: commerce.w3block.io
Authorization: Bearer JWT
Content-Type: application/json
Accept: */*
Content-Length: 1008

{
  "tags": [
    "7ca74ed3-93ff-4df9-b8a0-8308c590174b"
  ],
  "name": "W3Block Product",
  "description": "My Description",
  "images": [
    {
      "assetId": "123e4567-e89b-12d3-a456-426614174000",
      "variants": [
        {
          "keyLabel": "text",
          "keyValue": "text"
        }
      ]
    }
  ],
  "prices": [
    {
      "currencyId": "65fe1119-6ec0-4b78-8d30-cb989914bdcb",
      "amount": "0.01"
    }
  ],
  "distributionType": "random",
  "pricingType": "product",
  "startSaleAt": null,
  "endSaleAt": null,
  "draftData": {
    "keyCollectionId": null,
    "range": null
  },
  "slug": "text",
  "htmlContent": "<b>block</b>",
  "onDemandMintEnabled": true,
  "requirements": {
    "companyId": "123e4567-e89b-12d3-a456-426614174000",
    "keyCollectionId": "123e4567-e89b-12d3-a456-426614174000",
    "productId": "123e4567-e89b-12d3-a456-426614174000",
    "requirementCTALabel": "text",
    "requirementDescription": "text",
    "requirementModalContent": "text",
    "requireKycContext": {
      "slug": "text"
    }
  },
  "terms": null,
  "relevance": 0,
  "settings": {
    "passShareCodeConfig": {
      "dataFields": [
        {
          "name": "text",
          "type": "text",
          "label": "text",
          "required": true
        }
      ],
      "enabled": true
    },
    "acceptMultipleCurrenciesPurchase": true
  }
}

No content

PATCH /admin/companies/{companyId}/products/{productId}/publish HTTP/1.1
Host: commerce.w3block.io
Authorization: Bearer JWT
Accept: */*