From the course: Build a JavaScript AI App with React and the OpenAI API
Unlock the full course today
Join today to access over 24,500 courses taught by industry experts.
Test the API with a REST client
From the course: Build a JavaScript AI App with React and the OpenAI API
Test the API with a REST client
- [Instructor] Now that you have an API key for the OpenAI API, it is time to see what happens when we send requests through a REST client to the OpenAI API. And for this, I'll be using Postman as my client. You can use any client you want. I just happen to like the interface for Postman. So that's why I'm using it. And the process will be the same no matter what tool you use for this. To create an external call, it's a good idea to first go check out the API reference because it tells you how to authenticate and how to make requests. So I'll go into authentication here and it says the API key is a secret and the way you pass it in is through the authorization HTTP header as a Bearer token. So we're saying Authorization: Bearer and then OpenAI API key. Okay, so I already have the key, and I know that in Postman I can create environments. So I'll start here by creating a new environment for myself that stores the key…