Skip to content
C# SDK for Facebook Marketing API
Branch: master
Clone or download
ketanjawahire Merge pull request #24 from ketanjawahire/hotfix/remove_version_valid…

- Added a new constructor to accept api version as input parameter
Latest commit 05e89f1 Dec 9, 2018
Type Name Latest commit message Commit time
Failed to load latest commit information.
Facebook.ApiClient - Added a new constructor to accept api version as input parameter Dec 9, 2018
SampleApplication Removed Facebook.ApiClient & Facebook.ApiClient.Entities project refe… Feb 15, 2018
.gitignore Updated gitignore Feb 15, 2018
.travis.yml Updated travis.yml to build project using dotnet Feb 5, 2018
LICENSE Update Feb 15, 2018

Facebook.ApiClient Build Status

A C# SDK for Facebook Marketing API. The Facebook SDK for .NET helps developers build applications interacting with Facebook Marketing API. This project aims to help developers working with Facebook marketing API. Facebook supports REST API endpoints to interact with core object models. This SDK will help you in doing various API calls & converting API response into structured response. For Facebook entity classes you can refer to Facebook.ApiClient.Entities project.

Currently SDK supports GET, POST & Paged API requests. Batch API request support is planned in future release.

Nuget NuGet Nuget

	Install-Package Facebook.ApiClient

Code Example

Here is a short version of how to use this SDK. For more details check SampleApplication.

var accessToken = "<ACCESS_TOKEN>";
var apiClient = new ApiClient(accessToken);

//GET API request 
var getRequestUrl = "<GET_REQUEST_URL>";
var getRequest = (IGetRequest) ApiRequest.Create(ApiRequest.RequestType.Get, getRequestUrl, apiClient);

var getRequestResponse = getRequest.Execute();

//POST API Request
var postRequestUrl = "<POST_REQUEST_URL>";
var postRequest = (IPostRequest) ApiRequest.Create(ApiRequest.RequestType.Post, postRequestUrl, apiClient);
postRequest.AddFile("<filename>", <fileBytes>, <contentType>)

var postRequestResponse = postRequest.Execute();

//Paged API request
var pagedRequestUrl = "<PAGED_REQUEST_URL>";
var pagedRequest = (IPagedRequest) ApiRequest.Create(ApiRequest.RequestType.Paged, pagedRequestUrl, apiClient);
pagedRequest.AddQueryParameter("param1", "value1");
pagedRequest.AddUrlSegment("param2", "value2");

var result = new List<Class1>();
var pagedRequestResponse = pagedRequest.ExecutePage<Class1>();

if (pagedRequestResponse.IsDataAvailable())

	while (pagedRequestResponse.IsNextPageDataAvailable())
		pagedRequestResponse = pagedRequestResponse.GetNextPageData();

Supported Platforms

  • .NET 4.5.2
  • .NETStandard 2.0
You can’t perform that action at this time.