getSessionMessages
Method
GET
Endpoint URL
The xxxx.backendless.app
is a subdomain assigned to your application. For more information, see the Client-side Setup section of the Backendless documentation.
https://xxxx.backendless.app/api/services/OpenAI/session-messages?sessionId=value
Request URL Parameter
- sessionId – Required argument. Must be a string value. Session ID value received in the response of the createSession operation.
Request Headers
Content-Type:application/json
Request Body
N/A
Response Body
{
"messages": [
{
"role": "user",
"content": "prompt1"
},
{
"role": "assistant",
"content": "response1"
},
{
"role": "user",
"content": "prompt2"
},
{
"role": "assistant",
"content": "response2"
}
],
"aiModel": "value",
"id": "value",
"persistInDB": true or false
}
Sample response:
{
"messages": [
{
"role": "user",
"content": "Write a description for a product that can grind coffee beans and brew coffee"
},
{
"role": "assistant",
"content": "Introducing the CoffeeGrind Brewmaster, your ultimate companion for indulging in freshly ground coffee right at home. This ingenious product seamlessly combines the functionalities of a coffee grinder and a coffee brewer, ensuring that every cup you brew is bursting with the rich aroma and robust flavors of freshly ground beans.\n\nThe CoffeeGrind Brewmaster boasts a powerful grinder, equipped with stainless steel blades that effortlessly crush coffee beans to perfection. With adjustable settings, you can easily customize the grind size, from coarse for a satisfying French press to fine for a meticulously brewed espresso. Say goodbye to the hassle of manually grinding beans or compromising on flavor with pre-ground coffee.\n\nOnce your coffee beans are ground to your desired texture, the CoffeeGrind Brewmaster seamlessly transitions into a state-of-the-art coffee brewer. Its advanced filtration system ensures that there are no impurities or residue in your cup, delivering a seamless brewing process every time. The brewer features a programmable timer, allowing you to wake up to the tantalizing aroma of freshly brewed coffee or relax with a perfectly brewed cup after a long day.\n\nDesigned with user-friendliness in mind, the CoffeeGrind Brewmaster boasts an intuitive LED control panel, where you can easily adjust settings, choose from various brewing options, and even monitor the water level to ensure an optimal brewing experience. Its sleek and modern design seamlessly complements any kitchen décor, making it an elegant addition to your countertop.\n\nSafety is also paramount, and the CoffeeGrind Brewmaster is equipped with automatic shut-off and overheating protection features, giving you peace of mind while enjoying your coffee. The removable parts are dishwasher safe, offering effortless cleaning and maintenance.\n\nIndulge in the incredible flavor and aroma of freshly ground coffee beans with the CoffeeGrind Brewmaster. Experience the true joy of having a professional-grade coffee grinder and brewer in one remarkable product. Elevate your coffee brewing experience to new heights and delight in perfect, aromatic cups of coffee every day."
},
{
"role": "user",
"content": "What is the capital of India?"
},
{
"role": "assistant",
"content": "The capital of India is New Delhi."
}
],
"aiModel": "gpt-3.5-turbo",
"id": "258cd588-422b-4b7f-b705-d9132e9e1226",
"persistInDB": false
}
Response Body Parameters
- messages – An array of objects containing prompts and responses.
- role – A string value, specifies the role of the party in the session. Can be either “user” indicating the party that sends prompts or “assistant” indicating the party (AI) providing a response.
- content – A string value containing either a prompt or a response.
- aiModel – A string value containing an OpenAI model name used in the session.
- id – A string value of the session ID
- persistInDB – A boolean value indicating whether the session messages are stored in the Backendless database.
Codeless Reference
The Codeless logic below retrieves a collection of messages for a session. The sessionMessagesData
is the complete response object which contains the messages property containing a collection of the actual prompts and responses.