# Platforms(Create, Read, Update, Delete)

### 1. Set up your platform

To create a new Solana Play platform, you'll need to make a POST request to the `/platforms` endpoint. Make sure to fill in the required fields in the request body.

```http
POST /api/solanaplay/platforms
```

Request body:

```json
{
  "platformId": "unique-platform-id",
  "name": "platform-name",
  "url": "http://example.com",
  "twitter": "twitter-handle",
  "discordInvite": "http://example.com",
  "image": "image-url",
  "description": "platform-description",
  "category": "platform-category",
  "subcategory": "platform-subcategory",
  "tags": [
    "tag1",
    "tag2",
    "tag3"
  ]
}
```

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

```json
{
  "success": true,
  "message": "Operation successful",
  "platformId": "unique-platform-id",
  "platCustPub": "platform-custom-publication",
  "platformRefId": "platform-reference-id",
  "createdUTC": 0
}
```

Or a default message error:

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

If successful you will receive a `platformId`, `platCustPub`, and `platformRefId` in the response. Make sure you keep them in a safe place, as you will need them later. If in the event of an error a default message will occur. <br>

### 2. Manage Platform <a href="#id-2.-create-and-manage-items" id="id-2.-create-and-manage-items"></a>

Next, you'll need to manage the already created platform. To do this, make a GET request to the `platforms/{id}` endpoint with your `{id}`.\
&#x20;\
GET `/api/solanaplay/platforms/{id}`

```json
{
  "Id": "unique-platform-id"
}

```

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

```json
{
  "platformId": "unique-platform-id",
  "name": "platform-name",
  "url": "http://example.com",
  "twitter": "twitter-handle",
  "discordInvite": "http://example.com",
  "image": "image-url",
  "description": "platform-description",
  "category": "platform-category",
  "subcategory": "platform-subcategory",
  "tags": [
    "tag-name"
  ],
  "platformRefId": "platform-reference-id",
  "createdUTC": 0,
  "lastModified": "2019-08-24T14:15:22Z"
}

```

Or a default message error:

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

If successful will receive an overview of a single platform with `id`. If in the event of an error a default message will occur.

### 3. Update Platform <a href="#id-3.-generate-qr-codes-for-purchasing" id="id-3.-generate-qr-codes-for-purchasing"></a>

Next, you'll need to know how to change/update the already created platforms. To do this, make a PUT request to the `platforms/{id}` endpoint with your `{id}`.\
\
PUT `/api/solanaplay/platforms/{id}`

```json
{
  "platformId": "unique-platform-id",
  "name": "platform-name",
  "url": "http://example.com",
  "twitter": "twitter-handle",
  "discordInvite": "http://example.com",
  "image": "image-url",
  "description": "platform-description",
  "category": "platform-category",
  "subcategory": "platform-subcategory",
  "tags": [
    "tag-name"
  ],
  "platCustPub": "platform-custom-publication",
  "platCustPriv": "platform-custom-private-key",
  "platRandHex": "platform-random-hex",
  "adminPubkeys": [
    "admin-public-key"
  ],
  "platformRefId": "platform-reference-id",
  "createdUTC": 0,
  "lastModified": "2019-08-24T14:15:22Z"
}

```

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

```json
{
  "platformId": "unique-platform-id",
  "name": "platform-name",
  "url": "http://example.com",
  "twitter": "twitter-handle",
  "discordInvite": "http://example.com",
  "image": "image-url",
  "description": "platform-description",
  "category": "platform-category",
  "subcategory": "platform-subcategory",
  "tags": [
    "tag-name"
  ],
  "platformRefId": "platform-reference-id",
  "createdUTC": 0,
  "lastModified": "2019-08-24T14:15:22Z"
}
```

Or a default message error:

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

\
You will receive an updated overview of a platform item with `id`. If in the event of an error a default message will occur.

### 4. Delete item <a href="#id-4.-check-order-status" id="id-4.-check-order-status"></a>

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

```json
{
  "platformId": "unique-platform-id",
  "name": "platform-name",
  "url": "http://example.com",
  "twitter": "twitter-handle",
  "discordInvite": "http://example.com",
  "image": "image-url",
  "description": "platform-description",
  "category": "platform-category",
  "subcategory": "platform-subcategory",
  "tags": [
    "tag-name"
  ],
  "platformRefId": "platform-reference-id",
  "createdUTC": 0,
  "lastModified": "2019-08-24T14:15:22Z"
}

```

Or a default message error:

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

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

### 5. Manage all Items

Next, you will need to know how to manage all of the the already created platforms . To do this, make a GET request to the `/platforms`.\
\
GET `/api/solanaplay/platforms`

```json
{
  "Id": "unique-platform-id"
}
```

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

```json
[
  {
    "platformId": "unique-platform-id",
    "name": "platform-name",
    "url": "http://example.com",
    "twitter": "twitter-handle",
    "discordInvite": "http://example.com",
    "image": "image-url",
    "description": "platform-description",
    "category": "platform-category",
    "subcategory": "platform-subcategory",
    "tags": [
      "tag-name"
    ],
    "platformRefId": "platform-reference-id",
    "createdUTC": 0,
    "lastModified": "2019-08-24T14:15:22Z"
  }
]
```

Or a default message error:

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

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


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://moonshine-labs.gitbook.io/solanaplay/platforms-create-read-update-delete.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
