![]() Prismic is a headless website builder that allows you to build the structure of your own API and add content to it through the Prismic editor. Create a request to bring the documents that we need.In this case, we will use an API that comes from Prismic. In this example, our goal is to retrieve a successful 200 status code API response. Now let’s use our understanding of the Postman interface to make our first request. They are useful when you want to separate them by application, by feature, etc. Collections: they allow you to group your requests.They help you not to repeat information and to have order when managing the access of the data in your team. Environment Variables: they allow you to group a set of values that you can reuse in your requests.These options allow you to structure your projects if you have more than one endpoint, if you have lots of queries, and if you work with a large team. Once you gain experience using Postman you will find it very useful to use other organizational elements. You can learn more about status codes here. For example, 200 means that your response is correct, 400 that your request failed due to an error in your configuration, and 500 means there’s an error coming from the server. They tell you if everything is fine or if there is an error with your API call. Status codes are a series of standardized three-digit codes that represent the status of a response. Params and Headers help you make your request more specific and authentication is used to access private APIs that require tokens. These are optional values that you can pass to your API. To provide the required options, there are three tabs in Postman’s requests dashboard that you will use more frequently: Params, Auth, and Headers. Each API usually has its own documentation that tells you what kind of options you have for making your queries. Params, headers, and authenticationĮach API has requirements or specifications that are unique to each endpoint. The server then receives the request and returns a response, usually in the form of JSON. DELETE helps you delete content from the API.PATCH or PUT allows you to update existing content.POST allows you to write new content or update the existing one.GET retrieves content that is read-only.Here we will see the list of the most commonly used methods: ![]() Requests in Postman are made similarly but in a more didactic way. When the query request is sent, it communicates with the server with a CRUD HTTP request method that enables you to interact with the content of the API. Requests in your code can be made with many languages and structures, but in general, they happen as follows: you give your application an API endpoint and a query request written in REST or GraphQL. Here’s a preview of how the Dashboard looks in the desktop app:Īs we have already seen in the post on how APIs work, we know that they allow us to request data structures that we use in our apps. In the upper left corner of the center Scratch pad overview, click the + button to open a new work area and set up your calls. This is where you paste your API endpoint URL. The first and most important element is the request URL field. You will see that there are many elements with which you can interact let’s look at the more frequently used options so you understand the interface before diving in. To get a user's ID, for example, send a request to list the users in your org like you did in the previous section.Now let's learn how you can run an API on Postman.You can replace URL and body variables with the IDs of the resources that you want to specify. In the upper-right corner, click the box that lists the environments and then select $. Note: You can also download this environment locally and import it as a file.Ĭlick Continue and then Import to confirm your environment import. In the Import dialog box, click Link and then paste the following link into the Enter a URL box. Install the Postman app (opens new window). Each access token enables the bearer to perform specific actions on specific Okta endpoints, with that ability controlled by which scopes the access token contains. This is a feature that allows you to interact with Okta APIs using scoped OAuth 2.0 access tokens. Note: Alternatively, you can create an OAuth 2.0 access token for use with a number of Okta endpoints. When you create a new Okta org, the org is assigned a base URL such as. Don't have one? Create an org for free (opens new window). You need a free Okta developer edition org to get started. You can then send a test request and verify the results. To use these collections, you need to set up your local environment and import a collection. You can easily use our Postman collections to do just that. A great way to learn an API is to issue requests and inspect the responses. ![]()
0 Comments
Leave a Reply. |