im trying to make rest api with apex and i created class with the developer console but i not understand to wich url i send the request i also have accsess token. i just want to see im getting some response.

global class OyeCodeRestAPI {
global static Customer__c doGet() {

        RestRequest req = RestContext.request;

        RestResponse res = RestContext.response;

        //String accountId = req.requestURI.substring(req.requestURI.lastIndexOf('/')+1);

        Customer__c result = [SELECT Id, Name From Customer__c];

        return result;


1 Answer 1


To verify the Rest API, you can follow below steps,

  1. Navigate to https://workbench.developerforce.com/login.php.
  2. For Environment, select Production. For test orgs it will be sandbox.
  3. Select the latest API version from the API Version drop-down.
  4. Accept the terms of service, and click Login with Salesforce.
  5. To allow Workbench to access your information, click Allow.
  6. Enter your login credentials and then click Log in to Salesforce.
  7. After logging in, select utilities | REST Explorer.

  8. In Workbench, select GET.Enter the URI /services/apexrest/test (This would be RestResource Name)

  9. Click Execute.

Also, check trailhead module for REST Service

enter image description here

Namespaces in Apex REST Endpoints

Apex REST methods can be used in managed and unmanaged packages. When calling Apex REST methods that are contained in a managed package, you need to include the managed package namespace in the REST call URL. For example, if the class is contained in a managed package namespace called packageNamespace and the Apex REST methods use a URL mapping of /MyMethod/*, the URL used via REST to call these methods would be of the form https://instance.salesforce.com/services/apexrest/packageNamespace/MyMethod/.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .