> For the complete documentation index, see [llms.txt](https://documentation.astera.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://documentation.astera.com/astera-data-stack-v9/api-flows/api-consumption/consume/method-operations.md).

# Method Operations

In this article, we will be discussing various HTTP methods. We will see how HTTP requests can be made through the *REST Client* object in Astera.

For our use-cases, we have made use of the *Petstore* Open-API definition. We can import the API to the REST API Browser using its import URL.

Once done, it automatically establishes various pre-defined endpoints as *REST Client* objects. They can then be dragged and dropped onto a dataflow for further configurations and transformations.

![](/files/HL9DcOQyW7QNZp12uVTG)

{% hint style="info" %}
**Note:** When imported, a shared connection object will also be created containing the base URL and authentication details.
{% endhint %}

To learn more about importing a URL to the REST API Browser, click [here](/astera-data-stack-v9/api-flows/api-consumption/consume/rest-api-browser.md).

For the *Petstore* import URL, click [here](https://petstore.swagger.io/v2/swagger.json).

## **Making a GET Request**

1. First, we drag and drop the ‘*Find pet by ID’* endpoint from the browser onto the dataflow.

![](/files/AuKgf6stiHGaPM6mwgq1)

In this scenario, we want to get information for a pet with *PetId*, ‘3’. For this, we will pass the relevant *PetId* using a [*Constant Value* *Transformation*](/astera-data-stack-v9/dataflows/transformations/constant-value-transformation.md) object.

![](/files/ZdZ14B8OUBOPJsJxogrL)

2. To explore the *REST Client* object for this method, right-click on the object’s header and select *Properties.*

![](/files/R42A5Hx5tZgil5qUvvNn)

This will open the *REST Client* screen where the connection info of your API is defined.

![](/files/DQNx3CvnfMSXr7QiYOA4)

The *Shared Connection*, *Method*, and *Resource* here are already configured. Notice that *Resource* consists of ‘pet’ along with the ‘petId’ URL parameter.

![](/files/NdUOGcfgPyupZ4gukNAB)

3. Click *Next*.

![](/files/4elw8tGIqEhVr0CTNCw8)

Here, the ‘petId’ URL parameter follows from the defined resource.

For our use case, we will use this parameter to get details for a pet.

Click *Next* to proceed to the *Output Layout* screen, where you can view the *Response Layout* of your API. There are two ways in which you can generate the output layout if required.

4. The first one is by providing sample text by clicking the *Generate Layout by providing the Sample Text* option.
5. The other way to do this is by running a request by clicking the *Generate Layout by running the Request* option.

![](/files/XINLIgVP9VPq2CmgJ6fK)

6. Click *Next* to proceed to the *Pagination Options* screen.

For our use case, we have selected *None.*

![](/files/Xf4lFesuJzQV7t9alyg8)

7. Click *OK*.
8. You can preview the data by right-clicking on the object and selecting *Preview Output* from the context menu.

As seen below, the GET request that was made has fetched data according to the user application.

![](/files/oIWaEKE1r5s6m5hiOsf8)

## **Making a POST Request**

Now, let’s try adding a pet to *Petstore*.

1. Drag and drop the POST method as a *REST Client* object and open its *Properties*.

![](/files/V1sEZengl5KiqBRfKIDt)

We will pass the required parameters to the *POST request* object using a *Variables* object.

![](/files/0dCpNN7Tazpc6ZJpqXPC)

2. Now, right-click on the *REST API Client (addPet)* object and select *Preview Output*.

![](/files/LzeghZhyRDDYVGEg2I8G)

You can see that the *HTTPStatusCode* is “200”, which means that the REST API has successfully carried out the action requested by the client. Let’s verify it by making a GET request for the same *PetId* that we had posted earlier.

![](/files/t3f34LW4qZ1N0q6NEyZy)

You can see that a GET request for *PetId*, “1”, has returned the same information that we had posted.

![](/files/glVueQLTOivY7CfKRjuX)

## **Making a DELETE Request**

Now, let’s try making a DELETE request.

1. For this, we will first make a GET request to check whether that pet exists in the *Petstore* before we try to delete this record. We will pass *PetId*, “5”, using a *ConstantValue* object.

![](/files/RHjgUqJSep2L0FHLvFwr)

2. Right-click on the *REST Client (getPetById)* object and select *Preview Output*.

![](/files/RZScfUwiliZaSHvyOsOB)

It has fetched the details of the pet with *PetId*, “5”, and the status shows that the pet is available on *Petstore*.

3. To delete this pet record, we will drag and drop another DELETE *REST Client* object onto the flow and configure its *Properties* according to the DELETE method.

![](/files/UqZUWJfMSq1YHkVMo4RB)

4. Pass *PetId*, “5”, to the DELETE *request* object using a *ConstantValue* object.

![](/files/Cb8OlovQewcJ6OQ3pfvh)

5. Right-click on the *REST Client* object and select *Preview Output*. You can see that it has returned *HTTPStatusCode*, “200”, which indicates successful execution.

![](/files/t5iMhtnqiGS0L2Cngc7o)

Let’s verify it by making a GET request again, and check if the pet with *PetId*, “5”, has been deleted.

![](/files/zaG9Anxbznv10CzUYlsz)

6. Right-click on the *REST API Client* (*getPetById*) object and select *Preview Output.*

You can see that Astera has returned error 404 which means that there is no pet found with *PetId*, “5”, and the pet record has been successfully deleted from the *Petstore* API.

## **Making a PUT Request**

Let us now look at the PUT *HTTP Method*.

1. Drag and drop the *GET* endpoint from the REST API Browser onto the dataflow.

<figure><img src="/files/90geqd6YjRDBXm8sOkyJ" alt=""><figcaption></figcaption></figure>

2. Right-click on the object and select *Properties* from the context menu.
3. Click *Next,* and the *Parameters* screen will appear.

For this use case, we will be updating the Pet with an ID of ‘1’. Let’s define this ID in the *Default Value* field.

<figure><img src="/files/4HORYdVbZBpgdeGcUZ4p" alt=""><figcaption></figcaption></figure>

4. Click *OK* and preview the output by right-clicking on the object and selecting *Preview Output*

<figure><img src="/files/gS1XgHKgCwpAG58SOgoG" alt=""><figcaption></figcaption></figure>

As you can see in the preview screen below, the *GET* method has retrieved the Pet by ID.

<figure><img src="/files/FBCbspWLO7q0uVnX40KB" alt=""><figcaption></figcaption></figure>

5. Now, drag and drop the *PUT* endpoint from the REST API Browser onto the dataflow, labeled ‘*UpdatePet*’.

<figure><img src="/files/1PPD7EHMNqxv7bLG4k8l" alt=""><figcaption></figcaption></figure>

For our use case, we will be using this object for the *PUT* method so we can update the status of a pet.

6. Right-click on the object and select *Properties* from the context menu.

Our *Shared Connection* has already been defined.

The *HTTP Method* is *Put*, and the *Resource* to update is a pet.

<figure><img src="/files/1XTRSTVqSy2FzGoTnktp" alt=""><figcaption></figcaption></figure>

7. Click *Next*, and you will be led to the *Parameters* screen.

<figure><img src="/files/LDlLJp5xwb3ajaTIPPBG" alt=""><figcaption></figcaption></figure>

Since we are not defining any specific records here, we will click *Next* and head to the *Input Layout* screen, where a layout has already been populated from the imported API definition.

We have defined the status of the pet that we wish to update here. For our use case, we have changed the *status* from ‘available’ to ‘sold’.

<figure><img src="/files/kTr7RqOwSRSMdlIf2F8O" alt=""><figcaption></figcaption></figure>

8. Click *Next* and you will be led to the *Output Layout* screen, where the output has already been generated.

If required, an output can be generated by running a request using the available option.

<figure><img src="/files/MWxJxvWr1nWu28cx4ZeR" alt=""><figcaption></figcaption></figure>

9. Click *OK*, right-click on the object, and select *Preview Output*.

As you can see here, the *status* of the pet has been updated from ‘available’ to ‘sold’

<figure><img src="/files/CvGxshwiKNfIjzubkbOa" alt=""><figcaption></figcaption></figure>

10. We will now preview the output of the *GET* object we have configured to verify if the pet status has been updated.

As you can see, the value has been updated.

<figure><img src="/files/voVxUboBbgch1QypsufC" alt=""><figcaption></figcaption></figure>

## **Making a PATCH Request**

Since the *PetStore* OpenAPI Definition does not contain a PATCH request, we will be using the GoREST API for this use case.

Let’s make a GET request to see what information is there in the user ID where we want to update something.

1. To make a GET request, drag and drop the GET *REST Client* object onto the dataflow.

<figure><img src="/files/yspIUSxSaqnY0t270Xse" alt=""><figcaption></figcaption></figure>

2. Pass userID ‘89’ to the *id* under the *Parameters* node in the *GetUser* object using the *ConstantValue* transformation object.

<figure><img src="/files/STY6cI1qVq9NQBTQ5XSi" alt=""><figcaption></figcaption></figure>

3. Right-click the *REST Client* *(GetUser)* object’s header and select *Preview Output*.

<figure><img src="/files/K3eXU8t5qDVuqISyVowR" alt=""><figcaption></figcaption></figure>

Here is what the output looks like:

<figure><img src="/files/6XdtigrzjEWNQygNuuac" alt=""><figcaption></figcaption></figure>

4. Drag-and-drop the *PatchUser* *REST Client* object to use the PATCH method.

<figure><img src="/files/Qdmwd6jZKYhu0SfyRUww" alt=""><figcaption></figcaption></figure>

5. Pass *userId* ‘89’, and *email*, ‘<updatedemail@astera.com>’, using a *Variables* resource object.

<figure><img src="/files/m7UEAyc427iAq7UFuIRn" alt=""><figcaption></figcaption></figure>

6. Right-click on the *PatchUser* object’s header, and select *Preview Output*.

<figure><img src="/files/LDRI95AZpm0lxY6cI5MX" alt=""><figcaption></figcaption></figure>

You can see that the *HTTPStatusCode* is 200, which means that the REST API has successfully carried out the PATCH request. Let’s verify it by making a GET request for the same *userId* that we altered.

<figure><img src="/files/ovJVuB9AwUCdaaaHMHkG" alt=""><figcaption></figcaption></figure>

7. Right-click the *GetUser* object’s header and select *Preview Output*.

<figure><img src="/files/xAHSwkuWwNcEPhfYuNb0" alt=""><figcaption></figcaption></figure>

As you can see, the request has been successfully carried out and the *email* address has been updated.

This concludes our discussion on the HTTP method operations in Astera.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://documentation.astera.com/astera-data-stack-v9/api-flows/api-consumption/consume/method-operations.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
