Raw requests

With the latest release, n_2 offers the ability to tunnel raw requests to the underlying advertising platforms. This feature is particularly useful when you want to test a new feature or a new API that is not yet supported by n_2's unified API.

How to use it

To tunnel a raw request, instead of making an API request directly to the platforms API, you can make the exact same request agains n_2 by sending the request to the /raw of the particular platform.

For example, if you want to make a raw request to the Facebook API, you can send the request to https://api.n2api.io/facebook/raw. You use the exact same request body and headers as you would when making the request directly to the Facebook API. Also, you use the same query paths and parameters as you would when making the request directly to the Facebook API.

Here is an example of how you can make a raw GET request to the Facebook API using the curl command, requesting the current users facebook pages, that are available under the /me/accounts path of the Facebook API.

Request

GET
/v1/facebook/raw/me/accounts
curl -X GET https://api.n2api.io/facebook/raw/me/accounts

Response

{
	"responses": [
		{
			"data": [
				{
					"access_token": "...",
					"category": "Software Company",
					"category_list": [
						{
							"id": "106559...3495311",
							"name": "Software Company"
						}
					],
					"name": "My first Page",
					"id": "267451...787906",
					"tasks": [
						"ADVERTISE",
						"ANALYZE",
						"CREATE_CONTENT",
						"MESSAGING",
						"MODERATE",
						"MANAGE"
					]
				}
			],
			"paging": {
				"cursors": {
					"before": "QVFIUlFCZAFlxMUUtd3BiU1R2b1Qwc0ZAOQWFuN3A1TFVZAbUdwY28...FtVUp4OUxXZAzBBREVTRXZAJMl8ybGxkZA190XzNkN2U4UUh2cFRPSHY3TDh5cERHTWZAB",
					"after": "QVFIUlFCZAFlxMUUtd3BiU1R2b1Qwc0ZAOQWFuN3A1TFVZAbUdwY28...FtVUp4OUxXZAzBBREVTRXZAJMl8ybGxkZA190XzNkN2U4UUh2cFRPSHY3TDh5cERHTWZAB"
				}
			}
		}
	]
}

Response format

The response format of a raw request is the same as the response format of the underlying platform. The response is returned in the responses array, where each element in the array corresponds to a response from the underlying platform API.

Authentication

When making a raw request, you do not need to send authentication information for the underlying platform. n_2 will automatically authenticate the request on your behalf using the credentials you have provided when setting up the platform.

Was this page helpful?