Be a Supporter!

Browse Sections

Newgrounds Wiki: 01 - The Input Object

All calls to the Newgrounds.IO network API are passed in a single variable named 'input', using the POST method. The value of this variable will always be a JSON encoded object containing information identifying your application, the end user and whatever components you wish to call. This object gets posted to our gateway script at //newgrounds.io/gateway_v3.php

Here's an example of a JSON object that can be used to look up the current version of the API gateway:

{

"app_id": 'test',

"session_id": null,

"call": {

"component": "Gateway.getVersion"

}

}


This object is known as an "input object". In this object we are identifying our application via the app_id property, the end user via the session_id property, and we are telling it what component to execute via the call property.

In the above example, we are using the 'test' app id. This is our internal debugging app which you are free to test with. Your actual app_id can be found on the API Tools section of your project and will look something like "123456:AbcDeFgHI". We are also using a null session id because the call we are making does not require a user session.

The call property is a call object. This tells the API what component we want to execute. A component is essentially a server-side class method. In this example, the class we are using is "Gateway" and the method is "getVersion".

Check out the link below for a working JavaScript/jQuery example of how we can post the object above: https://jsfiddle.net/PsychoGoldfish/w5k55gL9/6/