Skip to content
man-git007 edited this page Mar 1, 2017 · 37 revisions

It gives all the contracts in the system with the basic metadata. The purpose is to do the listing of the contracts. It will allow basic optional filters for different sub-sites like for OLC,RC or for specific country. The filter will be limited to country code, year and category (OLC or RC).

Resource URI

/contracts?country_code={country_code}&year={year}&resource={resource}&category={category}&sort_by={sort_by}&order={order}&per_page={per_page}&from={from}

Parameter Description
country_code Filters the search result by country i.e country_code=cd. (Optional)
year Filters the search result by year i.e year=2005 (Optional)
category It filters the search result by the category. We have two options for this a)rc b) olc. i.e category=rc / olc.
resource Filters the search result by resource i.e resource=coal. The parameter to be passed is case sensitive Eg. contracts?resource=Gold (Optional).
sort_by It sorts the result according to contract name , contract type , resource , country and year.(Optional) Eg. contracts?resource=Gold&&sort_by=country,contract_name,resource
order It orders the result in asc(ascending) or desc(descending).Default is asc(ascending).(optional). Eg. contracts?sort_by=country&&order=asc
per_page It limit the search.Default is 25. Eg. contracts?sort_by=country&per_page=10
from Offset of next page result.Default is 0. Eg. contracts?sort_by=country&per_page=10&from=20

Response Attributes

{  
   total:Integer,
   per_page:Integer,
   from:Integer,
   results:[  
      {  
         id:Integer,
         open_contracting_id:String,
         name:String,
         country_code:String,
         year_signed:Integer,
         date_signed:String,
         contract_type:Array,
         language:String,
         resource:Array,
         category: Array (RC or OLC),
         is_ocr_reviewed:Boolean
      }
   ]
}

HTTP GET

Default Request

curl -GET http://end-point-uri/contracts

Response

HTTP Status Code 200

{
  total: 2,
  per_page: 25,
  from: 0,
  results: [
    {
      id: 701,
      open_contracting_id: "ocds-591adf-SL0498783225RC",
      name: "African Minerals, Tonkolili, Sierra Leone, 2010",
      country_code: "SL",
      year_signed: 2010,
      date_signed: "2010-06-08",
      contract_type: [
        "Concession Agreement"
      ],
      language: "en",
      resource: [
        "Iron Ore"
      ],
      category: [
        "rc"
      ],
      is_ocr_reviewed: true
    },
    {
      id: 698,
      open_contracting_id: "ocds-591adf-SL8360674726RC",
      name: "London Mining Company Limited, Sierra Leone, 2012",
      country_code: "SL",
      year_signed: 2012,
      date_signed: "2014-03-02",
      contract_type: [
        "-"
      ],
      language: "en",
      resource: [
        "Iron Ore"
      ],
      category: [
        "rc"
      ],
      is_ocr_reviewed: true
    }
}
    

Parameterized Request

Response

HTTP Status Code 200

curl -XGET http://end-point-uri/contracts?year=2005&country_code=lr&resource=Gold&per_page=5&from=0&sort_by=country&order=desc

{
  total: 2,
  per_page: 5,
  from: 0,
  results: [
    {
      id: 1015,
      open_contracting_id: "ocds-591adf-LR1084030457RC",
      name: "TRex Resources - Liberia, 2005",
      country_code: "LR",
      year_signed: 2005,
      date_signed: "2005-10-26",
      contract_type: [
        "Exploration Permit/License"
      ],
      language: "en",
      resource: [
        "Diamonds",
        "Gold",
        "Other minerals"
      ],
      category: [
        "rc"
      ],
      is_ocr_reviewed: true
    },
    {
      id: 1016,
      open_contracting_id: "ocds-591adf-LR0516995502RC",
      name: "Liberty Gold and Diamond Mining - Liberia, 2005",
      country_code: "LR",
      year_signed: 2005,
      date_signed: "2005-10-26",
      contract_type: [
        "Exploration Permit/License"
      ],
      language: "en",
      resource: [
        "Diamonds",
        "Gold"
      ],
      category: [
        "rc"
      ],
      is_ocr_reviewed: true
    }
  ]
}