Verify the REST Environment (REST-Based APIs)

You can verify your developer environment with a simple C# test application in Visual Studio.

You must have Visual Studio installed to create a C# test application.

  1. Start Visual Studio.

  2. Click File | New Project.

  3. In the New Project window, navigate to Installed | Templates | Visual C# | Windows. Select Console Application.

  4. In the New Project window, under Name, name the project VerifyRESTTest. Under Solution name, name the solution VerifyRESTTest. Under Location, pick a file location that you’ll remember. Click Ok. A solution is created, and Program.cs is opened for editing.

  5. Click Project | Add Reference.

  6. In the Reference Manager window, navigate to Assemblies | Framework. Select System.Runtime.Serialization. Ensure that the checkbox is selected, and click Ok.

  7. Replace the code in Program.cs as described in the following section.

Use the following simple login example code for your Program.cs file. Replace YOUR DEVORG USERNAME with your developer organization username, and replace YOUR DEVORG PASSWORD + SECURITY TOKEN with your developer organization password appended with your security token. If you did not set a security token in your organization, just provide your password. Replace YOUR OAUTH CONSUMER KEY with the consumer key from your development organization’s connected app. Replace YOUR OAUTH CONSUMER SECRET with the consumer secret from your development organization’s connected app. A GitHub Gist of this code is available here: https://gist.github.com/anonymous/db367194e6e24faa081b.

The following example output shows a typical successful run of this code.

If the verification C# project runs and displays output that matches your organization, your developer environment is set up and you can start developing .NET applications that integrate with Salesforce REST APIs.