Skip to main content

How to Update

How to Update an Image (iteam)

If you need to update an Image (iteam), you can do so by using the Snack Prompt API through the appropriate endpoint for updating elementals. To perform this action, you must be authenticated with your API Key.

How to Generate an API Key

To generate an API Key, follow these steps:

  1. Log in to your Snack Prompt account.
  2. Navigate to the API Keys page: https://snackprompt.com/api-keys.
  3. Click the Create New API Key button.
  4. Provide a name for your Key to easily identify it later.
  5. Once created, you can:
    • Copy the Key for immediate use.
    • Delete the Key when it's no longer needed.
Note: API Keys do not have an expiration date and will remain valid until deleted.
How to generate an API Key

How to Update an Image (iteam)

To update an Image (iteam), make a PUT request to the /v1/user/elemental/{id} endpoint. For this example, I will update an Image (iteam) type of Image (iteam).

Endpoint

PUT /v1/user/elemental/{id}

Params

  • id: The ID of the Image (iteam) you want to update.

Headers

  • x-api-key: Your API Key.

Here's how to update the Image (iteam).

Parameters and body content
PUT/v1/user/elemental/{id}

Properties

NameTypeRequiredDescription
idstringID of the elemental

Example

/v1/user/elemental/your-elemental-id

CURL Example

curl -X PUT "https://api-integrations.snackprompt.com/v1/user/elemental/{id}" \
-H "Content-Type: application/json" \
-H "x-api-key: YOUR_API_KEY" \
-d '{"title":"My First Image (iteam)","description":"<p>Snack Prompt is awesome!</p>","type_id":11,"files":[{"file_name":"file-4nt.pdf","file_buffer":{"0":37,"1":80,"2":68,"3":70,"4":45,"codepage":"binary"}}],"images":[{"file_name":"file-4nt.png","file_buffer":{"0":37,"1":80,"2":68,"3":70,"4":45,"codepage":"binary"}}]}'

Code Examples

You can also use the Snack Prompt API in different programming languages:

const response = await fetch(
"https://api-integrations.snackprompt.com/v1/elemental/{id}",
{
method: "PUT",
headers: {
"Content-Type": "application/json",
"x-api-key": "YOUR_API_KEY",
},
body: JSON.stringify({
title: "My First Image (iteam)",
description: "<p>Snack Prompt is awesome!</p>",
type_id: 11,
files: [
{
file_name: "file-4nt.pdf",
file_buffer: {
0: 37,
1: 80,
2: 68,
3: 70,
4: 45,
codepage: "binary",
},
},
],
images: [
{
file_name: "file-4nt.png",
file_buffer: {
0: 37,
1: 80,
2: 68,
3: 70,
4: 45,
codepage: "binary",
},
},
],
}),
}
);

if (response.ok) {
console.log("Image (iteam) updated successfully");
} else {
console.error("Failed to update Image (iteam)");
}

Practical Example

To better understand how the system works in practice, let's walk through a hands-on example where we'll update an Image (iteam).

Suppose you want to update an Image (iteam). In this case, we'll simulate the update of an Image (iteam) named "My First Image (iteam)" with a short description to identify its purpose.

Here are the key details you'll need:

  • Title: "My First Image (iteam)"

  • Description: "Snack Prompt is awesome!"

  • Type ID: 11 (This value identifies the elemental as an Image (iteam) in the system)

  • Files: [{"file_name": "file-4nt.pdf", "file_buffer": {"type": "Buffer", "data": [123, 10, 32, 32, 32, 32, 34, 110]}}]

  • Images: [{"file_name": "file-4nt.png", "file_buffer": {"type": "Buffer", "data": [123, 10, 32, 32, 32, 32, 34, 110]}}]

To proceed with the creation, you'll typically send a request (such as via an API or system interface) including the data above. The type_id = 11 is crucial, as it informs the backend logic that this elemental should be treated and structured as an Image (iteam) within the platform.

This approach allows users to structure and store information flexibly while maintaining consistency and clarity in how different types of Image (iteam)s are handled.

{
"title": "My First Image (iteam)",
"description": "<p>Snack Prompt is awesome!</p>",
"type_id": 11,
"files": [
{
"file_name": "file-4nt.pdf",
"file_buffer": {
"type": "Buffer",
"data": [
123,
10,
32,
32,
32,
32,
34,
110
]
}
}
],
"images": [
{
"file_name": "file-4nt.png",
"file_buffer": {
"type": "Buffer",
"data": [
123,
10,
32,
32,
32,
32,
34,
110
]
}
}
]
}
  1. CURL example:
curl -X PUT "https://api-integrations.snackprompt.com/v1/user/elemental/{id}"\
-H "Content-Type: application/json"
-H "x-api-key: YOUR_API_KEY"
-d '{"title":"My First Image (iteam)","description":"Snack Prompt is awesome!", "type_id": 11, "files": [{"file_name": "file-4nt.pdf", "file_buffer": {"type": "Buffer", "data": [123, 10, 32, 32, 32, 32, 34, 110]}}, {"file_name": "file-4nt.png", "file_buffer": {"type": "Buffer", "data": [123, 10, 32, 32, 32, 32, 34, 110]}}]'

Now if i need to update an Image (iteam), I can use the Snack Prompt API to update the Image (iteam). Click here to learn how to update an Image (iteam) and Body and Params to update an Image (iteam).