Making Requests

Constructing Requests

Requests are made of three components:

  • API version
  • Resource path
  • Output type

To construct a proper request, you will need to format the URI as follows:

https://api.yourepo.com/{version}/{resource}.{output_type}

An example request, to fetch a list of members who have purchased a package.

https://api.yourepo.com/1.0/package/buyers.json?package=com.yourepo.source.package

By default, requests are HTTP GET requests. However, many methods will require you to send POST data. Typically, we will follow the standard of all read requests use GET, and write requests use POST.

In addition to the required parameters for each individual method, you will also need to send your API key.

If you are using the server-side API, you will need to send secret_key with your secret API key value.

API version

For each request you should specify which version of the API you want to use. Currently, the default, and the only version available, is 1.0.

Resource path

The resource path is made available to you in further documentation.

Data Formats

YouRepo only supports one data format currently, JSON.

Responses

The response of your request will contain several key things:

  • HTTP status code
  • API status code
  • API response message

Let's take an example request:

GET https://api.yourepo.com/1.0/package/buyers?package=com.yourepo.source.package&secret_key=YOUR_SECRET_KEY
{
	"code": 0,
	"response": {
		"start": 0,
		"limit": 25,
		"total": "62",
		"page": 1,
		"buyers": [
			{
				"nickname": "member1",
				"status": "Completed",
				"profile_url": "https:\/\/www.yourepo.com\/forum\/profile\/member1"
			},
			{
				"nickname": "member2",
				"status": "Completed",
				"profile_url": "https:\/\/www.yourepo.com\/forum\/profile\/member2"
			},
			.....
		]
	}
}