sivakspt / NetCoreForce

Salesforce REST API toolkit for .NET Standard and .NET Core

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

NetCoreForce

A .NET Standard and .NET Core Salesforce REST API toolkit and API wrapper

This project is not offered, sponsored or endorsed by Salesforce.

This project is in Beta.

New features are being added. (Changelog)
There is a possibilty of breaking changes in upcoming releases, although they should be minor if they do happen.

Build status Build status

Currently targeting .NET Standard 1.3

Projects in this solution:

NuGet Packages

Client library has no unusual dependencies:

Using semantic versioning

Feedback and suggestions welcome.

Licensed under the MIT license.

Basic Usage Example

///Initialize the authentication client
AuthenticationClient auth = new AuthenticationClient();

//Pass in the login information
await auth.UsernamePasswordAsync("your-client-id", "your-client-secret", "your-username", "your-password", "token-endpoint-url");

//the AuthenticationClient object will then contain the instance URL and access token to be used in each of the API calls
ForceClient client = new ForceClient(auth.AccessInfo.InstanceUrl, auth.ApiVersion, auth.AccessInfo.AccessToken);

//Retrieve an object by Id
SfAccount acct = await client.GetObjectById<SfAccount>(SfAccount.SObjectTypeName, "001i000002C8QTI");
//Modify the record and update
acct.Description = "Updated Description";
await client.UpdateRecord<SfAccount>(SfAccount.SObjectTypeName, acct.Id, acct);
//Delete the record
await client.DeleteRecord(SfAccount.SObjectTypeName, acct.Id);

//Get the results of a SOQL query
List<SfCase> cases = await client.Query<SfCase>("SELECT Id,CaseNumber,Account.Name,Contact.Name FROM Case");

Nested Query Results

When you include related objects in a SOQL query:

SELECT Id,CaseNumber,Account.Name,Contact.Name FROM Case

And get the results via the client, you can then access the related objects and fields included in the query in a fluent manner.

List<SfCase> cases = await client.Query<SfCase>("SELECT Id,CaseNumber,Account.Name,Contact.Name FROM Case");
SfCase firstCase = cases[0];
string caseNumber = firstCase.CaseNumber;
string caseAccountName = firstCase.Account.Name;
string caseContactName = firstCase.Contact.Name;

About

Salesforce REST API toolkit for .NET Standard and .NET Core

License:MIT License


Languages

Language:C# 100.0%