Items(Create, Read, Update, Delete)

1. Create items.

You'll need to create items that can be purchased on your platform. To do this, make a POST request to the /items/{platformId} endpoint with your platformId. Make sure to fill in the required fields in the request body. POST /api/solanaplay/items/{platformId} Request body:

[
  {
    "itemId": "unique-item-id",
    "label": "product-label",
    "priceArray": [
      {
        "price": 0,
        "tokenName": "token-name",
        "token": "token-string",
        "active": true,
        "discountPrice": 0
      }
    ],
    "image": "image-url",
    "description": "product-description",
    "quantity": 0,
    "category": "product-category",
    "subcategory": "product-subcategory",
    "scenes": [
      "scene-name"
    ],
    "tags": [
      "tag-name"
    ],
    "requiredRoles": [
      "required-role"
    ],
    "excludedRoles": [
      "excluded-role"
    ],
    "position": {
      "xloc": 0,
      "zloc": 0,
      "yloc": 0,
      "rotation": {
        "x": 0,
        "y": 0,
        "z": 0,
        "w": 0
      }
    }
  }
]

Response examples: You will receive response 200(success) :

{
  "success": true,
  "message": "Operation successful",
  "platformId": "platform-id",
  "items": [
    {
      "itemId": "item-Id"
    }
  ]
}

Or a default message error:

{
  "error": {
    "code": 0,
    "message": "error-message"
  }
}

If successful you will receive a success, message, platformId and items in the response. If in the event of an error a default message will occur.

2. Manage Item

Next, you'll need to manage the already created items that can be purchased on your platform. To do this, make a GET request to the /items/{platformId}/{id} endpoint with your platformId and {id}(id in this case refers to the id of an item). GET /api/solanaplay/items/{platformId}/{id}

{
  "itemId": "unique-item-id"
}

Response examples: You will receive response 200(success) :

{
  "itemId": "unique-item-id",
  "label": "product-label",
  "priceArray": [
    {
      "price": 0,
      "tokenName": "token-name",
      "token": "token-string",
      "active": true,
      "discountPrice": 0
    }
  ],
  "image": "image-url",
  "description": "product-description",
  "quantity": 0,
  "category": "product-category",
  "subcategory": "product-subcategory",
  "scenes": [
    "scene-name"
  ],
  "tags": [
    "tag-name"
  ],
  "requiredRoles": [
    "required-role"
  ],
  "excludedRoles": [
    "excluded-role"
  ],
  "position": {
    "xloc": 0,
    "zloc": 0,
    "yloc": 0,
    "rotation": {
      "x": 0,
      "y": 0,
      "z": 0,
      "w": 0
    }
  },
  "itemPlatId": "platform-item-id",
  "platformId": "platform-id",
  "platformRefId": "platform-reference-id",
  "inStock": true,
  "itemRefId": "item-reference-id",
  "createdUTC": 0,
  "lastModified": "2019-08-24T14:15:22Z"
}

Or a default message error:

{
  "error": {
    "code": 0,
    "message": "error-message"
  }
}

If successful will receive an overview of a single item with platformId and id. If in the event of an error a default message will occur.

3. Update item

Next, you'll need to know how to change/update the already created items. To do this, make a PUT request to the /items{id} endpoint with your {id}(id in this case refers to the id of an item). PUT /api/solanaplay/items/{id}

{
  "itemId": "unique-item-id",
  "label": "product-label",
  "priceArray": [
    {
      "price": 0,
      "tokenName": "token-name",
      "token": "token-string",
      "active": true,
      "discountPrice": 0
    }
  ],
  "image": "image-url",
  "description": "product-description",
  "quantity": 0,
  "category": "product-category",
  "subcategory": "product-subcategory",
  "scenes": [
    "scene-name"
  ],
  "tags": [
    "tag-name"
  ],
  "requiredRoles": [
    "required-role"
  ],
  "excludedRoles": [
    "excluded-role"
  ],
  "position": {
    "xloc": 0,
    "zloc": 0,
    "yloc": 0,
    "rotation": {
      "x": 0,
      "y": 0,
      "z": 0,
      "w": 0
    }
  },
  "itemPlatId": "platform-item-id",
  "platformId": "platform-id",
  "platformRefId": "platform-reference-id",
  "inStock": true,
  "itemRefId": "item-reference-id",
  "createdUTC": 0,
  "lastModified": "2023-03-24T14:15:22Z"
}

Response examples: You will receive response 200(success) :

{
  "itemId": "unique-item-id",
  "label": "product-label",
  "priceArray": [
    {
      "price": 0,
      "tokenName": "token-name",
      "token": "token-string",
      "active": true,
      "discountPrice": 0
    }
  ],
  "image": "image-url",
  "description": "product-description",
  "quantity": 0,
  "category": "product-category",
  "subcategory": "product-subcategory",
  "scenes": [
    "scene-name"
  ],
  "tags": [
    "tag-name"
  ],
  "requiredRoles": [
    "required-role"
  ],
  "excludedRoles": [
    "excluded-role"
  ],
  "position": {
    "xloc": 0,
    "zloc": 0,
    "yloc": 0,
    "rotation": {
      "x": 0,
      "y": 0,
      "z": 0,
      "w": 0
    }
  },
  "itemPlatId": "platform-item-id",
  "platformId": "platform-id",
  "platformRefId": "platform-reference-id",
  "inStock": true,
  "itemRefId": "item-reference-id",
  "createdUTC": 0,
  "lastModified": "2019-08-24T14:15:22Z"
}

You will receive an updated overview of a single item with id.

4. Delete item

Next, you'll need to know how to delete the already created items. To do this, make a DELETE request to the /items/{id} endpoint with your {id}. DELETE /api/solanaplay/items/{id} You will receive response 200 :

{
  "itemId": "unique-item-id",
  "label": "product-label",
  "priceArray": [
    {
      "price": 0,
      "tokenName": "token-name",
      "token": "token-string",
      "active": true,
      "discountPrice": 0
    }
  ],
  "image": "image-url",
  "description": "product-description",
  "quantity": 0,
  "category": "product-category",
  "subcategory": "product-subcategory",
  "scenes": [
    "scene-name"
  ],
  "tags": [
    "tag-name"
  ],
  "requiredRoles": [
    "required-role"
  ],
  "excludedRoles": [
    "excluded-role"
  ],
  "position": {
    "xloc": 0,
    "zloc": 0,
    "yloc": 0,
    "rotation": {
      "x": 0,
      "y": 0,
      "z": 0,
      "w": 0
    }
  },
  "itemPlatId": "platform-item-id",
  "platformId": "platform-id",
  "platformRefId": "platform-reference-id",
  "inStock": true,
  "itemRefId": "item-reference-id",
  "createdUTC": 0,
  "lastModified": "2019-08-24T14:15:22Z"
}

Or a default message error:

{
  "error": {
    "code": 0,
    "message": "error-message"
  }
}

If successful you will receive a sucessful status 200 for the item deleted. If in the event of an error a default message will occur.

5. Manage all Items

Next, you'll need to know how to manage all of the the already created items . To do this, make a GET request to the /items/{platformId} endpoint with your platformId. GET /api/solanaplay/items/{platformId}

{
  "itemId": "unique-item-id"
}

Response examples: You will receive response 200(success) :

{
  "itemId": "unique-item-id",
  "label": "product-label",
  "priceArray": [
    {
      "price": 0,
      "tokenName": "token-name",
      "token": "token-string",
      "active": true,
      "discountPrice": 0
    }
  ],
  "image": "image-url",
  "description": "product-description",
  "quantity": 0,
  "category": "product-category",
  "subcategory": "product-subcategory",
  "scenes": [
    "scene-name"
  ],
  "tags": [
    "tag-name"
  ],
  "requiredRoles": [
    "required-role"
  ],
  "excludedRoles": [
    "excluded-role"
  ],
  "position": {
    "xloc": 0,
    "zloc": 0,
    "yloc": 0,
    "rotation": {
      "x": 0,
      "y": 0,
      "z": 0,
      "w": 0
    }
  },
  "itemPlatId": "platform-item-id",
  "platformId": "platform-id",
  "platformRefId": "platform-reference-id",
  "inStock": true,
  "itemRefId": "item-reference-id",
  "createdUTC": 0,
  "lastModified": "2019-08-24T14:15:22Z"
}

Or a default message error:

{
  "error": {
    "code": 0,
    "message": "error-message"
  }
}

If successful you will receive an overview of all items with id. If in the event of an error a default message will occur.

Last updated