Making Requests


Constructing Requests

Requests are made of three components:

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

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

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

http://api.yourepo.com/1.0/package/buyers.json?package=com.yourepo.repository.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.

For now, we use only server-side API.

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:

Let's take an example request:

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