Git Product home page Git Product logo

facebook.apiclient's Introduction

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);
getRequest.AddQueryParameter("param1","value1");
getRequest.AddQueryParameter("param2","value2");

var getRequestResponse = getRequest.Execute();


//POST API Request
var postRequestUrl = "<POST_REQUEST_URL>";
var postRequest = (IPostRequest) ApiRequest.Create(ApiRequest.RequestType.Post, postRequestUrl, apiClient);
postRequest.AddParameter("param1","value1");
postRequest.AddParameter("param2","value2");
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");
pagedRequest.AddPageLimit(20);

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

if (pagedRequestResponse.IsDataAvailable())
{
	result.AddRange(pagedRequestResponse.GetResultData());

	while (pagedRequestResponse.IsNextPageDataAvailable())
	{
		pagedRequestResponse = pagedRequestResponse.GetNextPageData();
		result.AddRange(pagedRequestResponse.GetResultData());
	}
}

Supported Platforms

  • .NET 4.5.2
  • .NETStandard 2.0

facebook.apiclient's People

Contributors

ketanjawahire avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.