Unsupported data type response when using gpt-4o REST API.

Tuan Nguyen 0 Reputation points
2025-02-18T17:00:47.5933333+00:00

Hi,

I'm following the instructions to call a gpt-4o model REST API using postman. These are the details:

endpoint:

https://rforce-ai-assist.openai.azure.com/openai/deployments/gpt-4o-2/chat/completions?api-version=2024-08-01-preview

headers:

{ "api-key": "......",

"Content-Type":           "application/json" }

body:

{ "prompt": "what time is it on italy?" }

However, I'm getting the following response:

Unsupported data type

I guess there must be something I'm missing, but at this point I fail to see... any help will be greatly appreciated!

Azure OpenAI Service
Azure OpenAI Service
An Azure service that provides access to OpenAI’s GPT-3 models with enterprise capabilities.
3,710 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Vikram Singh 1,955 Reputation points Microsoft Employee
    2025-02-19T08:33:00.6833333+00:00

    Hi Tuan Nguyen,

    Welcome to the Microsoft Q&A Forum! Thank you for your question.

    First, ensure that your request body is correctly formatted as JSON. The prompt parameter should be within a messages array, and each message should have a role and content. Here's an example of how your request body should look:

    {
      "messages": [
        {
          "role": "user",
          "content": "what time is it in Italy?"
        }
      ]
    }
    

    Make sure your headers include the correct Content-Type:

    {
      "api-key": "your_api_key_here",
      "Content-Type": "application/json"
    }
    

    Also, verify that your endpoint URL is correct and matches the deployment name and API version you are using. Based on the information you provided, it should be:

    https://rforce-ai-assist.openai.azure.com/openai/deployments/gpt-4o-2/chat/completions?api-version=2024-08-01-preview
    

    If you continue to face issues, please double-check the API documentation for any additional parameters or requirements that might be missing. You can refer to the Azure OpenAI Service REST API preview reference for more details.

    Do let me know if you are still the facing the issue.

    Thanks!


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.