Apex Web Services

Learn About Apex Web Services Unit | Salesforce Developer Guide

Apex Web Service

You'll uncover your Pinnacle lesson strategies as a REST or Cleanser web benefit operation. By making your strategies callable through the net, your outside applications can coordinate with Salesforce to perform all sorts of clever operations.

@RestResource(urlMapping='/Case/*')
global with sharing class MyRestResource {
    @HttpGet
    global static Case getRecord() {
        // Add your code
    }
}

As you'll see, the course is commented on with @RestResource(urlMapping='/Case/*'). The base endpoint for Summit REST is https://yourInstance.salesforce.com/services/apexrest/. The URL mapping is appended to the base endpoint to make the endpoint for your REST benefit. For case, within the course case, the REST endpoint is https://yourInstance.salesforce.com/services/apexrest/. For your org, it may see something like https://yourInstance.salesforce.com/services/apexrest/Case/*

dont miss out iconDon't forget to check out: Salesforce Apex Coding Best Practices | Developer Guide

The URL mapping is case-sensitive and can contain a wildcard character (*). Define each uncovered strategy as worldwide inactive and include an explanation to relate it with an HTTP strategy. The taking after explanations is accessible. You'll utilize each comment as it was once in each Summit class.

@HttpGetReadReads or retrieves records.
@HttpPostCreateCreates records.
@HttpDeleteDeleteDeletes records.
@HttpPutUpsertTypically utilized to upgrade existing records or make records.
@HttpPatchUpdateTypically utilized to overhaul areas in existing records.

dont miss out iconCheck out another amazing blog by Marziya here: Salesforce Service Cloud - An Introduction

Expose a Class as a SOAP Service

Making your Summit lesson accessible as a Cleanser web benefit is as simple as with REST. Characterize your lesson as worldwide. Include the webservice watchword and the inactive definition modifier to each strategy you need to uncover. The webservice watchword gives worldwide get to the strategy it is included too. For case, here’s a test lesson with one strategy. The getRecord strategy maybe a custom Cleanser API call that returns an Account record.

global with sharing class MySOAPWebService {
    webservice static Case getRecord(String id) {
        // Add your code
    }
}

Thank you!

Responses

Popular Salesforce Blogs