Developers

Tutorial: A Basic Request

In this example, we will construct a simple PHP script to get the unique Change.org ID of
a petition using the petitions/get_id request.

1. Obtain an API key and petition URL

Before you start using Change.org's API you will need an API key. You can obtain one by
requesting it here. You may need to
verify the email address associated with your account if you have not done so already.

Let's start by declaring the API key and endpoint to which we will make the request at the
top of our script:

2. Declare the clear-text parameters of your request

Every Change.org request requires the api_key as a parameter.
petitions/get_id requests take one additional parameter, petition_url,
which is the URL of the petition for which we want to get the unique Change.org ID.