> For the complete documentation index, see [llms.txt](https://docs.langstack.com/welcome/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.langstack.com/welcome/get-started/learn-langstack/introduction-to-entities/exercise-1-customer-accounts-and-activities/customer-accounts/step-3-update-entity-through-api.md).

# Step 3: Update entity through API

Once the Entity and API are created, the API can be tested to update records in the Entity “UserName\_Acc\_customers.”

* To test the API, click on the \[Test] button.

<figure><img src="https://media.langstack.com/documentation/media/images/code/training_manual/chapter_5/testapi.png" alt=""><figcaption></figcaption></figure>

* The Test API box will display the “Entity actions” toggle button disabled.

{% hint style="info" %}
Note: If “Entity actions” is not enabled, testing an API using entity actions will result in the status of “failed” in the response.
{% endhint %}

* To allow the Entity to be updated or created with entity actions, click the “Entity actions” toggle button.

<figure><img src="https://media.langstack.com/documentation/media/images/code/training_manual/chapter_5/apitestenableentity.png" alt=""><figcaption></figcaption></figure>

* Select the default API gateway as “UserName\_Acc\_AddCustomer”.\
  If the user The default API gateway will be selected if the user does not select an API gateway

<figure><img src="https://media.langstack.com/documentation/media/images/code/training_manual/chapter_5/ch5ex1testapigateway.png" alt=""><figcaption></figcaption></figure>

* In the “Request” section, update the Json object as follows:\
  `{"Address":"Rose Street",`\
  `"City":"Kuala Lumpur",`\
  `"Customer_Value":5,`\
  `"Country":"Malaysia",`\
  `"Email":"JaneDoe@mail.com",`\
  `"First_Name":"Jane",`\
  `"IsActive":true,`\
  `"Join_Date":"2021-09-15",`\
  `"Last_Name":"Doe",`\
  `"Phone":"1237865",`\
  `"Rating":1000,`\
  `"Zip_Code":"45"}`

<figure><img src="https://media.langstack.com/documentation/media/images/code/training_manual/chapter_5/ch5ex1testrequest.png" alt=""><figcaption></figcaption></figure>

* To test if the record is created in the target entity, click the \[Test API] button.

<figure><img src="https://media.langstack.com/documentation/media/images/code/training_manual/chapter_5/ch5ex1testbutton.png" alt=""><figcaption></figcaption></figure>

* The Response section in the Test dialog displays a record creation success message.

<figure><img src="https://media.langstack.com/documentation/media/images/code/training_manual/chapter_5/ch5testsuccessbody.png" alt=""><figcaption></figcaption></figure>

* If the “Entity actions” field is disabled and the API is tested, the Body section in the Test dialog displays an error message when the \[Test API] button is clicked.
* In the list of Entities, click on “UserName\_Acc\_customers”. The created record will be displayed. Note that, as per requirements, the value in the “Customer\_Value” field is returned as “0” and the value in the “Rating” field is returned as “1” as defined in the “Actions”.

<figure><img src="https://media.langstack.com/documentation/media/images/code/training_manual/chapter_5/ch5apicreatedrec.png" alt=""><figcaption></figcaption></figure>


---

# 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://docs.langstack.com/welcome/get-started/learn-langstack/introduction-to-entities/exercise-1-customer-accounts-and-activities/customer-accounts/step-3-update-entity-through-api.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.
