---
schema_version: "1"
id: 7612f51f5182523066498ad5cc45d0374c82958741de2c5a76be2cf6758410e0
title: Apex REST Code Samples
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/apexcode/apex_rest_code_samples.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_rest_code_samples.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: 8619fb5b3cefbf8d142a21b8be8c3e5eaac4b0d65fd47f5217bccd4ed9c69981
---
# Apex REST Code Samples

These code samples show you how to expose Apex classes and methods through the REST architecture and how to call those resources from a client.

- **[Apex REST Basic Code Sample](https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_rest_code_sample_basic.htm)**  
    This sample shows how to implement a simple REST API in Apex with three HTTP request methods to delete, retrieve, and update a record.
- **[Apex REST Code Sample Using RestRequest](https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_rest_code_sample_restrequest.htm)**  
    This sample shows you how to add an attachment to a record by using the RestRequest object.