-
Notifications
You must be signed in to change notification settings - Fork 13
C# SDK Configuration
First of all you have to download JustGiving SDK package from NuGet.org either from website JustGiving SDK or by command
PM> Install-Package justgiving-sdk
Then if you have downloaded a JustGiving SDK you have to create an instance of JustGivingClient
var client = new JustGiving.Api.Sdk.JustGivingClient("APIKEY");
Code above is required to do any request against our API!
If you would like to change an environment simply you have to create an instance of ClientConfiguration
var clientConfig = new Api.Sdk.ClientConfiguration("https://api-sandbox.justgiving.com/", "api-key", 1);
or for live server
var clientConfig = new Api.Sdk.ClientConfiguration("https://api.justgiving.com/", "api-key", 1);
and then pass into JustGivingClient argument
var client = new JustGiving.Api.Sdk.JustGivingClient(clientConfig);
To add authentication for your request, simply you have to set up username and password for client
clientConfig.Username = "username";
clientConfig.Password = "password";
If you are going to use C# SDK against Data API you have to add new attribute into your web.config or app.config
<justGivingDataSdk CharityId="yourCharityId" RootDomain="environmentAPIUrl " ApiVersion="1" ApiKey="yourAppKey" Username="justgivingUserName" Password="password" />
RootDomain is basically an endpoint of chosen environment (live or sandbox) http://dataapi.justgiving.com/ or http://dataapi-sandbox.justgiving.com/
This is required to make any request against Data API.