What Are the Supported HTTP Methods in Appian Web APIs?
What Are the Supported HTTP Methods in Appian Web APIs?
Answer
Appian Web APIs support five HTTP methods: GET, POST, PUT, DELETE, and PATCH.
External applications use Web APIs to read data from Appian, create or update records, delete records, or start business processes.
1. GET: retrieve data
GET reads information from Appian without changing anything.
- Example: return the details of a loan application for a given application ID.
- Use case: query records with
a!queryRecordType(). - Note: a GET Web API can’t execute smart services.
2. POST: create data or trigger actions
POST sends information to Appian to create records or start a business process.
- Example: an external application submits a new loan application to Appian.
- Use case: create records with
a!writeRecords()or start a process witha!startProcess(). - Note: POST Web APIs can execute smart services.
3. PUT: update or replace data
PUT usually updates or replaces an existing resource.
- Example: overwrite all the editable details of an existing loan application.
- Use case: update existing records with
a!writeRecords(). - Note: PUT Web APIs can execute smart services.
4. PATCH: partially update data
PATCH changes specific fields of an existing resource and leaves the rest alone.
- Example: change only the loan application’s status from
PENDINGtoAPPROVED. - Use case: update selected record fields while keeping the other values.
- Note: PATCH Web APIs can execute smart services.
5. DELETE: remove data
DELETE removes records or documents when the business rules call for it.
- Example: delete a draft loan application that nobody needs anymore.
- Use case: run the delete through the appropriate Appian smart service.
- Note: DELETE Web APIs can execute smart services.
Practical example: loan management application
Say an external banking application talks to Appian through Web APIs. The calls might look like this:
HTTP Method | Endpoint | Operation |
|---|---|---|
GET |
| Retrieve loan details |
POST |
| Create a loan application |
PUT |
| Replace loan details |
PATCH |
| Update loan status |
DELETE |
| Delete a draft loan |
These endpoints are only examples. What each one actually does depends on how you build the Web API.
Interview question: PUT vs. PATCH
Scenario: a loan application has these values:
- Application ID: 101
- Applicant Name: John
- Loan Amount: $50,000
- Status: PENDING
The business wants to change only the Status field to APPROVED. Which HTTP method fits better?
Answer: PATCH.
PATCH is meant for partial updates, while PUT typically replaces the resource’s whole representation.
Appian doesn’t enforce either behavior for you, though. The developer has to write the logic in the Web API expression that makes PUT and PATCH behave the way they should.
Points to remember
- GET can’t execute smart services. If a GET Web API tries to run one, it fails with an error.
- POST, PUT, PATCH, and DELETE can all execute smart services.
- Appian handles HEAD and OPTIONS requests automatically. You can’t pick them as methods for a Web API.
- Every Web API has to return an HTTP response built with
a!httpResponse(). - POST, PUT, and PATCH Web APIs can accept document uploads, up to Appian’s documented limit of 75 MB.
- An HTTP method doesn’t run any database operation by itself. The developer still has to write that logic.
Check yourself
Question 1 of 2, on what the answer above covers.
- 1.An external application calls an Appian GET Web API to retrieve loan details. A developer also includes a!writeRecords() in the Web API expression to update the loan's last-accessed timestamp. What happens when the API executes?
- 2.A loan application contains Applicant Name, Loan Amount, Loan Type, and Status. An external application needs to update only the Status from PENDING to APPROVED without modifying the other fields. Which HTTP method is most appropriate?