Welcome to openregistry.lots.basic’s documentation!

Please report any problems or suggestions for improvement either via the mailing list or the issue tracker.

Contents:

Overview

openregistry.lots.basic contains the description of the Registry Data Base.

Features

  • Lots are formed by DGF.
  • Several assets (or the one only) may be included in one lot.
  • Assets which are included in lot, will be marked as attached to it, after that lot is finally formed.
  • In case of at least one asset, which is going to be included in a lot, has already been attached to another one, such a lot will be marked as invalid.
  • After lot has been successfully created, it becomes available for auction.

Conventions

API accepts JSON or form-encoded content in requests. It returns JSON content in all of its responses, including errors. Only the UTF-8 character encoding is supported for both requests and responses.

All API POST and PUT requests expect a top-level object with a single element in it named data. Successful responses will mirror this format. The data element should itself be an object, containing the parameters for the request.

If the request was successful, we will get a response code of 201 indicating the object was created. That response will have a data field at its top level, which will contain complete information on the new lot, including its ID.

If something went wrong during the request, we’ll get a different status code and the JSON returned will have an errors field at the top level containing a list of problems. We look at the first one and print out its message.


Project status

The project has pre alpha status.

The source repository for this project is on GitHub: https://github.com/openprocurement/openregistry.api

API stability

API is relatively stable. The changes in the API are communicated via Open Procurement API maillist.

Next steps

You might find it helpful to look at the Tutorial.

Data Standard

Data standard is modelled along the Open Contracting Standard with extensions in areas that were not covered by it.

Basic Lot

Schema

id:

string, auto-generated, read-only

lotID:

string, auto-generated, read-only

The lot identifier to refer that lot to in the paper documentation.

OpenContracting Description: LotID is included to make the flattened data structure more convenient.

date:

string, auto-generated, read-only

The date of lot creation/undoing.

dateModified:

string, auto-generated, read-only

OpenContracting Description: Date when the lot was last modified.

status:

string, required

The lot status within the Registry.

value:

Value, required

Estimated lot value.

assets:

string, optional

ID of the related basic asset.

lotType:

string, required

Type of the given lot.

title:

string, multilingual

  • Ukrainian by default (required) - Ukrainian title
  • title_en (English) - English title
  • title_ru (Russian) - Russian title

Oprionally can be mentioned in English/Russian.

description:

string, multilingual, optional

OpenContracting Description: A description of the goods, services to be provided.

  • Ukrainian by default - Ukrainian decription
  • decription_en (English) - English decription
  • decription_ru (Russian) - Russian decription
documents:

OpenContracting Description: All related documents and attachments.

lotCustodian:

Organization, required

An entity managing the lot.

mode:

optional

The additional parameter with a value test.

Value

Schema

amount:

float, required

Should be positive.

currency:

string, required

OpenContracting Description: The currency in 3-letter ISO 4217 format.

valueAddedTaxIncluded:
 

bool, required

Organization

Schema

name:

string, multilingual

Name of the organization.

identifier:

Identifier

The primary identifier for this organization.

additionalIdentifiers:
 

List of Identifier objects

address:

Address, required

contactPoint:

ContactPoint, required

Identifier

Schema

scheme:

string

OpenContracting Description: Organization identifiers be drawn from an existing identification scheme. This field is used to indicate the scheme or codelist in which the identifier will be found. This value should be drawn from the Organization Identifier Scheme.

id:

string, required

OpenContracting Description: The identifier of the organization in the selected scheme.

The allowed codes are the ones found in “Organisation Registration Agency” codelist of IATI Standard with addition of UA-EDR code for organizations registered in Ukraine (EDRPOU and IPN).

legalName:

string, multilingual

OpenContracting Description: The legally registered name of the organization.

Full legal name (e.g. Nadra Bank).

uri:

uri

OpenContracting Description: A URI to identify the organization, such as those provided by Open Corporates or some other relevant URI provider. This is not for listing the website of the organization: that can be done through the url field of the Organization contact point.

Address

Schema

streetAddress:

string

OpenContracting Description: The street address. For example, 1600 Amphitheatre Pkwy.

locality:

string

OpenContracting Description: The locality. For example, Mountain View.

region:

string

OpenContracting Description: The region. For example, CA.

postalCode:

string

OpenContracting Description: The postal code. For example, 94043.

countryName:

string, multilingual, required

OpenContracting Description: The country name. For example, United States.

ContactPoint

Schema

name:

string, multilingual, required

OpenContracting Description: The name of the contact person, department, or contact point, for correspondence relating to this contracting process.

email:

email

OpenContracting Description: The e-mail address of the contact point/person.

telephone:

string

OpenContracting Description: The telephone number of the contact point/person. This should include the international dialling code.

faxNumber:

string

OpenContracting Description: The fax number of the contact point/person. This should include the international dialling code.

url:

URL

OpenContracting Description: A web address for the contact point/person.

Either email or telephone field has to be provided.

Lots Workflow

digraph G {
        node [style=filled, color=lightgrey];
        edge[style=dashed];
        "draft" -> "pending";
        edge[style=dashed]
        "pending" -> "deleted";
        edge[style=dashed];
        "pending" -> "verification";
        edge[style=solid];
        "verification" -> "pending";
        edge[style=solid];
        "verification" -> "active.salable";
        edge[style=dashed];
        "active.salable" -> "pending.dissolution";
        edge[style=solid];
        "pending.dissolution" -> "dissolved"
        edge[style=solid];
        "active.salable" -> "active.awaiting";
        edge[style=solid];
        "active.awaiting" -> "active.salable";
        edge[style=solid];
        "active.awaiting" -> "active.auction";
        edge[style=solid];
        "active.auction" -> "sold";
}

Legend

  • dashed line - user action
  • solid line - action is done automatically

Tutorial

Exploring basic rules

Let’s try exploring the /lots endpoint:

GET /api/0.1/lots?opt_pretty=1 HTTP/1.0
Authorization: Basic YnJva2VyOg==
Host: lb.api-sandbox.registry.ea.openprocurement.net

Response: 200 OK
Content-Type: application/json
X-Content-Type-Options: nosniff
{
  "next_page": {
    "path": "/api/0.1/lots?offset=", 
    "uri": "http://lb.api-sandbox.registry.ea.openprocurement.net/api/0.1/lots?offset=", 
    "offset": ""
  }, 
  "data": []
}

Just invoking it reveals empty set.

Now let’s attempt creating a lot:

POST /api/0.1/lots?opt_pretty=1 HTTP/1.0
Authorization: Basic YnJva2VyOg==
Content-Length: 4
Content-Type: application/x-www-form-urlencoded
Host: lb.api-sandbox.registry.ea.openprocurement.net

Response: 415 Unsupported Media Type
Content-Type: application/json
X-Content-Type-Options: nosniff
{
  "status": "error", 
  "errors": [
    {
      "description": "Content-Type header should be one of ['application/json']", 
      "location": "header", 
      "name": "Content-Type"
    }
  ]
}

Error states that the only accepted Content-Type is application/json.

Let’s satisfy the Content-type requirement:

POST /api/0.1/lots?opt_pretty=1 HTTP/1.0
Authorization: Basic YnJva2VyOg==
Content-Length: 4
Content-Type: application/json
Host: lb.api-sandbox.registry.ea.openprocurement.net

Response: 422 Unprocessable Entity
Content-Type: application/json
X-Content-Type-Options: nosniff
{
  "status": "error", 
  "errors": [
    {
      "description": "No JSON object could be decoded", 
      "location": "body", 
      "name": "data"
    }
  ]
}

Error states that no data has been found in JSON body.

Creating lot

Let’s create lot with the minimal (only required) data set:

POST /api/0.1/lots?opt_pretty=1 HTTP/1.0
Authorization: Basic YnJva2VyOg==
Content-Length: 1071
Content-Type: application/json
Host: lb.api-sandbox.registry.ea.openprocurement.net
DATA:
{
  "data": {
    "description": "Щось там тестове", 
    "lotType": "basic", 
    "lotCustodian": {
      "contactPoint": {
        "name": "Державне управління справами", 
        "telephone": "0440000000"
      }, 
      "identifier": {
        "scheme": "UA-EDR", 
        "id": "00037256", 
        "uri": "http://www.dus.gov.ua/"
      }, 
      "name": "Державне управління справами", 
      "address": {
        "countryName": "Україна", 
        "postalCode": "01220", 
        "region": "м. Київ", 
        "streetAddress": "вул. Банкова, 11, корпус 1", 
        "locality": "м. Київ"
      }
    }, 
    "assets": [
      "d336c262c697423eb947c8628900f056"
    ], 
    "title": "Тестовий лот"
  }
}

Response: 201 Created
Content-Type: application/json
Location: http://lb.api-sandbox.registry.ea.openprocurement.net/api/0.1/lots/def2b43f991d47319cbf18b2631df5a1
X-Content-Type-Options: nosniff
{
  "access": {
    "token": "b6bac0414e514d3ab9dd3ab1b772a90d"
  }, 
  "data": {
    "status": "draft", 
    "lotID": "UA-LR-DGF-2017-09-27-000001", 
    "description": "Щось там тестове", 
    "title": "Тестовий лот", 
    "lotType": "basic", 
    "dateModified": "2017-09-27T16:00:29.136878+03:00", 
    "owner": "broker", 
    "lotCustodian": {
      "contactPoint": {
        "name": "Державне управління справами", 
        "telephone": "0440000000"
      }, 
      "identifier": {
        "scheme": "UA-EDR", 
        "id": "00037256", 
        "uri": "http://www.dus.gov.ua/"
      }, 
      "name": "Державне управління справами", 
      "address": {
        "postalCode": "01220", 
        "countryName": "Україна", 
        "streetAddress": "вул. Банкова, 11, корпус 1", 
        "region": "м. Київ", 
        "locality": "м. Київ"
      }
    }, 
    "date": "2017-09-27T16:00:29.134940+03:00", 
    "id": "def2b43f991d47319cbf18b2631df5a1", 
    "assets": [
      "d336c262c697423eb947c8628900f056"
    ]
  }
}
PATCH /api/0.1/lots/def2b43f991d47319cbf18b2631df5a1?acc_token=b6bac0414e514d3ab9dd3ab1b772a90d HTTP/1.0
Authorization: Basic YnJva2VyOg==
Content-Length: 31
Content-Type: application/json
Host: lb.api-sandbox.registry.ea.openprocurement.net
DATA:
{
  "data": {
    "status": "pending"
  }
}

Response: 200 OK
Content-Type: application/json
X-Content-Type-Options: nosniff
{
  "data": {
    "status": "pending", 
    "lotID": "UA-LR-DGF-2017-09-27-000001", 
    "description": "Щось там тестове", 
    "title": "Тестовий лот", 
    "lotType": "basic", 
    "dateModified": "2017-09-27T16:00:29.181044+03:00", 
    "owner": "broker", 
    "lotCustodian": {
      "contactPoint": {
        "name": "Державне управління справами", 
        "telephone": "0440000000"
      }, 
      "identifier": {
        "scheme": "UA-EDR", 
        "id": "00037256", 
        "uri": "http://www.dus.gov.ua/"
      }, 
      "name": "Державне управління справами", 
      "address": {
        "postalCode": "01220", 
        "countryName": "Україна", 
        "streetAddress": "вул. Банкова, 11, корпус 1", 
        "region": "м. Київ", 
        "locality": "м. Київ"
      }
    }, 
    "date": "2017-09-27T16:00:29.180875+03:00", 
    "id": "def2b43f991d47319cbf18b2631df5a1", 
    "assets": [
      "d336c262c697423eb947c8628900f056"
    ]
  }
}
PATCH /api/0.1/lots/def2b43f991d47319cbf18b2631df5a1?acc_token=b6bac0414e514d3ab9dd3ab1b772a90d HTTP/1.0
Authorization: Basic YnJva2VyOg==
Content-Length: 36
Content-Type: application/json
Host: lb.api-sandbox.registry.ea.openprocurement.net
DATA:
{
  "data": {
    "status": "verification"
  }
}

Response: 200 OK
Content-Type: application/json
X-Content-Type-Options: nosniff
{
  "data": {
    "status": "verification", 
    "lotID": "UA-LR-DGF-2017-09-27-000001", 
    "description": "Змінений опис тестового лоту", 
    "title": "Тестовий лот", 
    "lotType": "basic", 
    "dateModified": "2017-09-27T16:00:29.360216+03:00", 
    "owner": "broker", 
    "lotCustodian": {
      "contactPoint": {
        "name": "Державне управління справами", 
        "telephone": "0440000000"
      }, 
      "identifier": {
        "scheme": "UA-EDR", 
        "id": "00037256", 
        "uri": "http://www.dus.gov.ua/"
      }, 
      "name": "Державне управління справами", 
      "address": {
        "postalCode": "01220", 
        "countryName": "Україна", 
        "streetAddress": "вул. Банкова, 11, корпус 1", 
        "region": "м. Київ", 
        "locality": "м. Київ"
      }
    }, 
    "date": "2017-09-27T16:00:29.360053+03:00", 
    "id": "def2b43f991d47319cbf18b2631df5a1", 
    "assets": [
      "d336c262c697423eb947c8628900f056"
    ]
  }
}

Success! Now we can see that new object was created. Response code is 201 and Location response header reports the location of the created object. The body of response reveals the information about the created lot: its internal id (that matches the Location segment), its official lotID and dateModified datestamp stating the moment in time when lot was last modified. Pay attention to the lotType. Note that lot is created with verification status.

Let’s access the URL of the created object (the Location header of the response):

We can see the same response we got after creating lot.

GET /api/0.1/lots?opt_pretty=1 HTTP/1.0
Authorization: Basic YnJva2VyOg==
Host: lb.api-sandbox.registry.ea.openprocurement.net

Response: 200 OK
Content-Type: application/json
X-Content-Type-Options: nosniff
{
  "next_page": {
    "path": "/api/0.1/lots?offset=2017-09-27T16%3A00%3A29.360216%2B03%3A00", 
    "uri": "http://lb.api-sandbox.registry.ea.openprocurement.net/api/0.1/lots?offset=2017-09-27T16%3A00%3A29.360216%2B03%3A00", 
    "offset": "2017-09-27T16:00:29.360216+03:00"
  }, 
  "data": [
    {
      "id": "def2b43f991d47319cbf18b2631df5a1", 
      "dateModified": "2017-09-27T16:00:29.360216+03:00"
    }
  ]
}

Let’s see what listing of lots reveals us:

We do see the internal id of the lot (that can be used to construct full URL by prepending https://lb.api-sandbox.registry.ea.openprocurement.net/api/0.1/lots/) and its dateModified datestamp.

The previous lot contained only required fields. Let’s try creating lot with more data (lot has status created):

POST /api/0.1/lots?opt_pretty=1 HTTP/1.0
Authorization: Basic YnJva2VyOg==
Content-Length: 1071
Content-Type: application/json
Host: lb.api-sandbox.registry.ea.openprocurement.net
DATA:
{
  "data": {
    "description": "Щось там тестове", 
    "lotType": "basic", 
    "lotCustodian": {
      "contactPoint": {
        "name": "Державне управління справами", 
        "telephone": "0440000000"
      }, 
      "identifier": {
        "scheme": "UA-EDR", 
        "id": "00037256", 
        "uri": "http://www.dus.gov.ua/"
      }, 
      "name": "Державне управління справами", 
      "address": {
        "countryName": "Україна", 
        "postalCode": "01220", 
        "region": "м. Київ", 
        "streetAddress": "вул. Банкова, 11, корпус 1", 
        "locality": "м. Київ"
      }
    }, 
    "assets": [
      "d336c262c697423eb947c8628900f056"
    ], 
    "title": "Тестовий лот"
  }
}

Response: 201 Created
Content-Type: application/json
Location: http://lb.api-sandbox.registry.ea.openprocurement.net/api/0.1/lots/d793267872c14bd9b871101968fa7270
X-Content-Type-Options: nosniff
{
  "access": {
    "token": "0f51da9ca6b24fbb8d48147d956679df"
  }, 
  "data": {
    "status": "draft", 
    "lotID": "UA-LR-DGF-2017-09-27-000002", 
    "description": "Щось там тестове", 
    "title": "Тестовий лот", 
    "lotType": "basic", 
    "dateModified": "2017-09-27T16:00:29.512356+03:00", 
    "owner": "broker", 
    "lotCustodian": {
      "contactPoint": {
        "name": "Державне управління справами", 
        "telephone": "0440000000"
      }, 
      "identifier": {
        "scheme": "UA-EDR", 
        "id": "00037256", 
        "uri": "http://www.dus.gov.ua/"
      }, 
      "name": "Державне управління справами", 
      "address": {
        "postalCode": "01220", 
        "countryName": "Україна", 
        "streetAddress": "вул. Банкова, 11, корпус 1", 
        "region": "м. Київ", 
        "locality": "м. Київ"
      }
    }, 
    "date": "2017-09-27T16:00:29.509278+03:00", 
    "id": "d793267872c14bd9b871101968fa7270", 
    "assets": [
      "d336c262c697423eb947c8628900f056"
    ]
  }
}
PATCH /api/0.1/lots/d793267872c14bd9b871101968fa7270?acc_token=0f51da9ca6b24fbb8d48147d956679df HTTP/1.0
Authorization: Basic YnJva2VyOg==
Content-Length: 31
Content-Type: application/json
Host: lb.api-sandbox.registry.ea.openprocurement.net
DATA:
{
  "data": {
    "status": "pending"
  }
}

Response: 200 OK
Content-Type: application/json
X-Content-Type-Options: nosniff
{
  "data": {
    "status": "pending", 
    "lotID": "UA-LR-DGF-2017-09-27-000002", 
    "description": "Щось там тестове", 
    "title": "Тестовий лот", 
    "lotType": "basic", 
    "dateModified": "2017-09-27T16:00:29.552068+03:00", 
    "owner": "broker", 
    "lotCustodian": {
      "contactPoint": {
        "name": "Державне управління справами", 
        "telephone": "0440000000"
      }, 
      "identifier": {
        "scheme": "UA-EDR", 
        "id": "00037256", 
        "uri": "http://www.dus.gov.ua/"
      }, 
      "name": "Державне управління справами", 
      "address": {
        "postalCode": "01220", 
        "countryName": "Україна", 
        "streetAddress": "вул. Банкова, 11, корпус 1", 
        "region": "м. Київ", 
        "locality": "м. Київ"
      }
    }, 
    "date": "2017-09-27T16:00:29.551901+03:00", 
    "id": "d793267872c14bd9b871101968fa7270", 
    "assets": [
      "d336c262c697423eb947c8628900f056"
    ]
  }
}
PATCH /api/0.1/lots/806ab85348a24519bfee2e950bafa0f3?acc_token=311509e8adbb45f8bdf106c128f9bd1d HTTP/1.0
Authorization: Basic YnJva2VyOg==
Content-Length: 43
Content-Type: application/json
Host: lb.api-sandbox.registry.ea.openprocurement.net
DATA:
{
  "data": {
    "status": "pending.dissolution"
  }
}

Response: 200 OK
Content-Type: application/json
X-Content-Type-Options: nosniff
{
  "data": {
    "status": "pending.dissolution", 
    "lotID": "UA-LR-DGF-2017-09-27-000003", 
    "description": "Щось там тестове", 
    "title": "Тестовий лот", 
    "lotType": "basic", 
    "dateModified": "2017-09-27T16:00:30.118687+03:00", 
    "owner": "broker", 
    "lotCustodian": {
      "contactPoint": {
        "name": "Державне управління справами", 
        "telephone": "0440000000"
      }, 
      "identifier": {
        "scheme": "UA-EDR", 
        "id": "00037256", 
        "uri": "http://www.dus.gov.ua/"
      }, 
      "name": "Державне управління справами", 
      "address": {
        "postalCode": "01220", 
        "countryName": "Україна", 
        "streetAddress": "вул. Банкова, 11, корпус 1", 
        "region": "м. Київ", 
        "locality": "м. Київ"
      }
    }, 
    "date": "2017-09-27T16:00:30.118464+03:00", 
    "id": "806ab85348a24519bfee2e950bafa0f3", 
    "assets": [
      "2b472e973c0646f7916197602e724cf6"
    ]
  }
}

And again we have 201 Created response code, Location header and body with extra id, lotID, and dateModified properties. For lot to be dissolved you have to specify pending.dissolution status. After some check would have been done, lot status will be switched to dissolved automatically.

Let’s check what lot registry contains:

GET /api/0.1/lots?opt_pretty=1 HTTP/1.0
Authorization: Basic YnJva2VyOg==
Host: lb.api-sandbox.registry.ea.openprocurement.net

Response: 200 OK
Content-Type: application/json
X-Content-Type-Options: nosniff
{
  "next_page": {
    "path": "/api/0.1/lots?offset=2017-09-27T16%3A00%3A29.552068%2B03%3A00", 
    "uri": "http://lb.api-sandbox.registry.ea.openprocurement.net/api/0.1/lots?offset=2017-09-27T16%3A00%3A29.552068%2B03%3A00", 
    "offset": "2017-09-27T16:00:29.552068+03:00"
  }, 
  "data": [
    {
      "id": "def2b43f991d47319cbf18b2631df5a1", 
      "dateModified": "2017-09-27T16:00:29.360216+03:00"
    }, 
    {
      "id": "d793267872c14bd9b871101968fa7270", 
      "dateModified": "2017-09-27T16:00:29.552068+03:00"
    }
  ]
}

And indeed we have 2 lots now.

Modifying Lot

Let’s update lot description:

PATCH /api/0.1/lots/def2b43f991d47319cbf18b2631df5a1?acc_token=b6bac0414e514d3ab9dd3ab1b772a90d HTTP/1.0
Authorization: Basic YnJva2VyOg==
Content-Length: 182
Content-Type: application/json
Host: lb.api-sandbox.registry.ea.openprocurement.net
DATA:
{
  "data": {
    "description": "Змінений опис тестового лоту"
  }
}

Response: 200 OK
Content-Type: application/json
X-Content-Type-Options: nosniff
{
  "data": {
    "status": "pending", 
    "lotID": "UA-LR-DGF-2017-09-27-000001", 
    "description": "Змінений опис тестового лоту", 
    "title": "Тестовий лот", 
    "lotType": "basic", 
    "dateModified": "2017-09-27T16:00:29.219961+03:00", 
    "owner": "broker", 
    "lotCustodian": {
      "contactPoint": {
        "name": "Державне управління справами", 
        "telephone": "0440000000"
      }, 
      "identifier": {
        "scheme": "UA-EDR", 
        "id": "00037256", 
        "uri": "http://www.dus.gov.ua/"
      }, 
      "name": "Державне управління справами", 
      "address": {
        "postalCode": "01220", 
        "countryName": "Україна", 
        "streetAddress": "вул. Банкова, 11, корпус 1", 
        "region": "м. Київ", 
        "locality": "м. Київ"
      }
    }, 
    "date": "2017-09-27T16:00:29.180875+03:00", 
    "id": "def2b43f991d47319cbf18b2631df5a1", 
    "assets": [
      "d336c262c697423eb947c8628900f056"
    ]
  }
}

We see the added properies have merged with existing lot data. Additionally, the dateModified property was updated to reflect the last modification datestamp.

Checking the listing again reflects the new modification date:

GET /api/0.1/lots?opt_pretty=1 HTTP/1.0
Authorization: Basic YnJva2VyOg==
Host: lb.api-sandbox.registry.ea.openprocurement.net

Response: 200 OK
Content-Type: application/json
X-Content-Type-Options: nosniff
{
  "next_page": {
    "path": "/api/0.1/lots?offset=2017-09-27T16%3A00%3A29.219961%2B03%3A00", 
    "uri": "http://lb.api-sandbox.registry.ea.openprocurement.net/api/0.1/lots?offset=2017-09-27T16%3A00%3A29.219961%2B03%3A00", 
    "offset": "2017-09-27T16:00:29.219961+03:00"
  }, 
  "data": [
    {
      "id": "def2b43f991d47319cbf18b2631df5a1", 
      "dateModified": "2017-09-27T16:00:29.219961+03:00"
    }
  ]
}

Deleting Lot

Let’s delete lot:

Integration with assets

Concierge operations

For lot to be formed, you need to specify some id of the assets to be included in that lot. If all of the assets are available, they will be attached to lot and status will be changed to active.salable:

GET /api/0.1/lots/806ab85348a24519bfee2e950bafa0f3 HTTP/1.0
Authorization: Basic Y29uY2llcmdlOg==
Host: lb.api-sandbox.registry.ea.openprocurement.net

Response: 200 OK
Content-Type: application/json
X-Content-Type-Options: nosniff
{
  "data": {
    "status": "active.salable", 
    "lotID": "UA-LR-DGF-2017-09-27-000003", 
    "description": "Щось там тестове", 
    "title": "Тестовий лот", 
    "lotType": "basic", 
    "dateModified": "2017-09-27T16:00:30.062247+03:00", 
    "owner": "broker", 
    "lotCustodian": {
      "contactPoint": {
        "name": "Державне управління справами", 
        "telephone": "0440000000"
      }, 
      "identifier": {
        "scheme": "UA-EDR", 
        "id": "00037256", 
        "uri": "http://www.dus.gov.ua/"
      }, 
      "name": "Державне управління справами", 
      "address": {
        "postalCode": "01220", 
        "countryName": "Україна", 
        "streetAddress": "вул. Банкова, 11, корпус 1", 
        "region": "м. Київ", 
        "locality": "м. Київ"
      }
    }, 
    "date": "2017-09-27T16:00:30.061948+03:00", 
    "id": "806ab85348a24519bfee2e950bafa0f3", 
    "assets": [
      "2b472e973c0646f7916197602e724cf6"
    ]
  }
}

In case of at least one of the assets is unavailable (e.g. it has already been attached to another lot), status of the current one will be turned to pending:

GET /api/0.1/lots/d3e21de3ab594b5495e5efec0e3a5930 HTTP/1.0
Authorization: Basic Y29uY2llcmdlOg==
Host: lb.api-sandbox.registry.ea.openprocurement.net

Response: 200 OK
Content-Type: application/json
X-Content-Type-Options: nosniff
{
  "data": {
    "status": "pending", 
    "lotID": "UA-LR-DGF-2017-09-27-000004", 
    "description": "Щось там тестове", 
    "title": "Тестовий лот", 
    "lotType": "basic", 
    "dateModified": "2017-09-27T16:00:30.317104+03:00", 
    "owner": "broker", 
    "lotCustodian": {
      "contactPoint": {
        "name": "Державне управління справами", 
        "telephone": "0440000000"
      }, 
      "identifier": {
        "scheme": "UA-EDR", 
        "id": "00037256", 
        "uri": "http://www.dus.gov.ua/"
      }, 
      "name": "Державне управління справами", 
      "address": {
        "postalCode": "01220", 
        "countryName": "Україна", 
        "streetAddress": "вул. Банкова, 11, корпус 1", 
        "region": "м. Київ", 
        "locality": "м. Київ"
      }
    }, 
    "date": "2017-09-27T16:00:30.316904+03:00", 
    "id": "d3e21de3ab594b5495e5efec0e3a5930", 
    "assets": [
      "2b472e973c0646f7916197602e724cf6"
    ]
  }
}

When bot finds that status of a lot is pending.dissolution, turn status of the assets being attached to that lot to pending. Status of the lot itself will become dissolved.

PATCH /api/0.1/lots/806ab85348a24519bfee2e950bafa0f3 HTTP/1.0
Authorization: Basic Y29uY2llcmdlOg==
Content-Length: 33
Content-Type: application/json
Host: lb.api-sandbox.registry.ea.openprocurement.net
DATA:
{
  "data": {
    "status": "dissolved"
  }
}

Response: 200 OK
Content-Type: application/json
X-Content-Type-Options: nosniff
{
  "data": {
    "status": "dissolved", 
    "lotID": "UA-LR-DGF-2017-09-27-000003", 
    "description": "Щось там тестове", 
    "title": "Тестовий лот", 
    "lotType": "basic", 
    "dateModified": "2017-09-27T16:00:30.163264+03:00", 
    "owner": "broker", 
    "lotCustodian": {
      "contactPoint": {
        "name": "Державне управління справами", 
        "telephone": "0440000000"
      }, 
      "identifier": {
        "scheme": "UA-EDR", 
        "id": "00037256", 
        "uri": "http://www.dus.gov.ua/"
      }, 
      "name": "Державне управління справами", 
      "address": {
        "postalCode": "01220", 
        "countryName": "Україна", 
        "streetAddress": "вул. Банкова, 11, корпус 1", 
        "region": "м. Київ", 
        "locality": "м. Київ"
      }
    }, 
    "date": "2017-09-27T16:00:30.163056+03:00", 
    "id": "806ab85348a24519bfee2e950bafa0f3", 
    "assets": [
      "2b472e973c0646f7916197602e724cf6"
    ]
  }
}

Convoy operations

When lot is finally formed (active.saleable) it can be used in the procedure within CDB. For this to be done, you need to specify lot id. By doing this, you will find the merchandisingObject field with the current lot id in the created procedure and id of the auction within which it is going to be sold. Status of the lot used will be automatically changed to active.awaiting in RDB. This indicates that Organizer is creating some auction with this lot within CDB, so it is currently unavailable for usage.

GET /api/0.1/lots/d3e21de3ab594b5495e5efec0e3a5930 HTTP/1.0
Authorization: Basic Y29udm95Og==
Host: lb.api-sandbox.registry.ea.openprocurement.net

Response: 200 OK
Content-Type: application/json
X-Content-Type-Options: nosniff
{
  "data": {
    "status": "active.awaiting", 
    "lotID": "UA-LR-DGF-2017-09-27-000004", 
    "description": "Щось там тестове", 
    "title": "Тестовий лот", 
    "lotType": "basic", 
    "dateModified": "2017-09-27T16:00:30.445550+03:00", 
    "owner": "broker", 
    "lotCustodian": {
      "contactPoint": {
        "name": "Державне управління справами", 
        "telephone": "0440000000"
      }, 
      "identifier": {
        "scheme": "UA-EDR", 
        "id": "00037256", 
        "uri": "http://www.dus.gov.ua/"
      }, 
      "name": "Державне управління справами", 
      "address": {
        "postalCode": "01220", 
        "countryName": "Україна", 
        "streetAddress": "вул. Банкова, 11, корпус 1", 
        "region": "м. Київ", 
        "locality": "м. Київ"
      }
    }, 
    "date": "2017-09-27T16:00:30.445342+03:00", 
    "id": "d3e21de3ab594b5495e5efec0e3a5930", 
    "assets": [
      "2b472e973c0646f7916197602e724cf6"
    ]
  }
}

When the procedure is successfully created, lot status will be changed to active.auction:

GET /api/0.1/lots/d3e21de3ab594b5495e5efec0e3a5930 HTTP/1.0
Authorization: Basic Y29udm95Og==
Host: lb.api-sandbox.registry.ea.openprocurement.net

Response: 200 OK
Content-Type: application/json
X-Content-Type-Options: nosniff
{
  "data": {
    "status": "active.auction", 
    "lotID": "UA-LR-DGF-2017-09-27-000004", 
    "description": "Щось там тестове", 
    "title": "Тестовий лот", 
    "lotType": "basic", 
    "dateModified": "2017-09-27T16:00:30.608496+03:00", 
    "owner": "broker", 
    "lotCustodian": {
      "contactPoint": {
        "name": "Державне управління справами", 
        "telephone": "0440000000"
      }, 
      "identifier": {
        "scheme": "UA-EDR", 
        "id": "00037256", 
        "uri": "http://www.dus.gov.ua/"
      }, 
      "name": "Державне управління справами", 
      "address": {
        "postalCode": "01220", 
        "countryName": "Україна", 
        "streetAddress": "вул. Банкова, 11, корпус 1", 
        "region": "м. Київ", 
        "locality": "м. Київ"
      }
    }, 
    "date": "2017-09-27T16:00:30.608168+03:00", 
    "id": "d3e21de3ab594b5495e5efec0e3a5930", 
    "assets": [
      "2b472e973c0646f7916197602e724cf6"
    ]
  }
}

After lot has been sold in the auction, its status is turned to sold within RDB:

GET /api/0.1/lots/d3e21de3ab594b5495e5efec0e3a5930 HTTP/1.0
Authorization: Basic Y29udm95Og==
Host: lb.api-sandbox.registry.ea.openprocurement.net

Response: 200 OK
Content-Type: application/json
X-Content-Type-Options: nosniff
{
  "data": {
    "status": "sold", 
    "lotID": "UA-LR-DGF-2017-09-27-000004", 
    "description": "Щось там тестове", 
    "title": "Тестовий лот", 
    "lotType": "basic", 
    "dateModified": "2017-09-27T16:00:30.673845+03:00", 
    "owner": "broker", 
    "lotCustodian": {
      "contactPoint": {
        "name": "Державне управління справами", 
        "telephone": "0440000000"
      }, 
      "identifier": {
        "scheme": "UA-EDR", 
        "id": "00037256", 
        "uri": "http://www.dus.gov.ua/"
      }, 
      "name": "Державне управління справами", 
      "address": {
        "postalCode": "01220", 
        "countryName": "Україна", 
        "streetAddress": "вул. Банкова, 11, корпус 1", 
        "region": "м. Київ", 
        "locality": "м. Київ"
      }
    }, 
    "date": "2017-09-27T16:00:30.673668+03:00", 
    "id": "d3e21de3ab594b5495e5efec0e3a5930", 
    "assets": [
      "2b472e973c0646f7916197602e724cf6"
    ]
  }
}

In case of that lot has not been sold, its status will be changed to active.salable in RDB:

GET /api/0.1/lots/d3e21de3ab594b5495e5efec0e3a5930 HTTP/1.0
Authorization: Basic Y29udm95Og==
Host: lb.api-sandbox.registry.ea.openprocurement.net

Response: 200 OK
Content-Type: application/json
X-Content-Type-Options: nosniff
{
  "data": {
    "status": "active.salable", 
    "lotID": "UA-LR-DGF-2017-09-27-000004", 
    "description": "Щось там тестове", 
    "title": "Тестовий лот", 
    "lotType": "basic", 
    "dateModified": "2017-09-27T16:00:30.501176+03:00", 
    "owner": "broker", 
    "lotCustodian": {
      "contactPoint": {
        "name": "Державне управління справами", 
        "telephone": "0440000000"
      }, 
      "identifier": {
        "scheme": "UA-EDR", 
        "id": "00037256", 
        "uri": "http://www.dus.gov.ua/"
      }, 
      "name": "Державне управління справами", 
      "address": {
        "postalCode": "01220", 
        "countryName": "Україна", 
        "streetAddress": "вул. Банкова, 11, корпус 1", 
        "region": "м. Київ", 
        "locality": "м. Київ"
      }
    }, 
    "date": "2017-09-27T16:00:30.500967+03:00", 
    "id": "d3e21de3ab594b5495e5efec0e3a5930", 
    "assets": [
      "2b472e973c0646f7916197602e724cf6"
    ]
  }
}

Retrieving Lot Information

Getting list of all lots

Getting list of all lots.

Example request:

Example response:

query offset:offset number
query limit:limit number. default is 100
reqheader Authorization:
 optional OAuth token to authenticate
statuscode 200:no error
statuscode 404:endpoint not found

Sorting

Lots returned are sorted by modification time.

Limiting number of Lots returned

You can control the number of data entries in the lots feed (batch size) with limit parameter. If not specified, data is being returned in batches of 100 elements.

Batching

The response contains next_page element with the following properties:

offset:This is the parameter you have to add to the original request you made to get next page.
path:This is path section of URL with original parameters and offset parameter added/replaced above.
uri:The full version of URL for next page.

If next page request returns no data (i.e. empty array) then there is little sense in fetching further pages.

Synchronizing

It is often necessary to be able to syncronize central database changes with other database (we’ll call it “local”). The default sorting “by modification date” together with Batching mechanism allows one to implement synchronization effectively. The synchronization process can go page by page until there is no new data returned. Then the synchronizer has to pause for a while to let central database register some changes and attempt fetching subsequent page. The next_page guarantees that all changes from the last request are included in the new batch.

The safe frequency of synchronization requests is once per 5 minutes.

Reading the individual lot information

Getting lot details.

Example request:

Example response:

reqheader Authorization:
 optional OAuth token to authenticate
statuscode 200:no error
statuscode 404:lot not found

Authentication

Some of the API requests (especially the ones that are read-only GET requests) do not require any authenication. The other ones, that modify data into the database, require broker authentication via API key. Additionally, owner tokens are issued to facilitate multiple actor roles upon object creation.

API keys

API key is username to use with Basic Authenication scheme.

Owner tokens

Getting token

The token is issued when object is created in the database:

You can see the access with token in response. Its value can be used to modify objects further under “Owner role”.

Using token

You can pass access token in the following ways:

  1. acc_token URL query string parameter
  2. X-Access-Token HTTP request header
  3. access.token in the body of POST/PUT/PATCH request

See the example of the action with token passed as URL query string:

API in cluster mode

There is a cluster of several servers that synchronize data between each other. Client should always work with the same server to ensure consistency between separate requests to the RDB. That is why cookie is required while sending POST/PUT/PATCH/DELETE requests. Cookies provide server stickiness. You can get such cookie via GET request and then use it for POST/PUT/PATCH/DELETE.

If during operations the server requested by cookie went down or is unavailable, client will receive status code 412 of request and new cookie to use. Request should be repeated with new cookie.

Options

In addition to providing fields and their values in a request, you may also specify options to control how your request is interpreted and how the response is generated. For GET requests, options are specified as URL parameters prefixed with opt_. For POST or PUT requests, options are specified in the body, inside the top-level options object (a sibling of the data object). The option specified in the body overrides the opt_ one from URL parameter.

These options can be used in different combinations in a single request, though some of them may conflict in their impact on the response.

pretty:

?opt_pretty

options: { pretty: true }

Provides the response in “pretty” output. In case of JSON this means doing proper line breaking and indentation to make it readable. This will take extra time and increase the response size so it is advisable to use this only during debugging.

jsonp:

?opt_jsonp=myCallback

Returns the output in JSON-P format instead of plain JSON. This allows requests to come from within browsers and work around the “same origin policy.” The function named as the value of the opt_jsonp parameter will be called with a single argument, a JavaScript object representing the response.

fields:

?opt_fields=comma,separated,field,list

List of extra fields to include in response.

Performance recommendations

Rate Control

“Aggressive” IP addresses can be restricted in the speed with which servers are processing RDB requests. In this case RDB will respond with status code 429 to the requests that returned faster than allowed.

Expected client response to such restriction is to repeat requests returned with 429 status code increasing the delay between individual requests sent to the RDB until requests become successful (2xx / 3xx responses).

Such RDB servers behavior is required in order to distribute server resources evenly between clients.

Date Format: ISO 8601

The date format is ISO 8601.

http://imgs.xkcd.com/comics/iso_8601.png

Responses

After processing API always provides response, reporting either success or failure.

Status Codes

In all cases, the API should return an HTTP Status Code that indicates the nature of the failure (see below), with a response body in JSON format containing additional information.

200
Success. If data was requested, it will be available in the data field at the top level of the response body.
201
Success (for object creation). Its information is available in the data field at the top level of the response body. The API URL where the object can be retrieved is also returned in the Location header of the response.
400
Invalid request. This usually occurs because of a missing or malformed parameter. Check the documentation and the syntax of your request and try again.
401
No authorization. A valid API key was not provided with the request, so the API could not associate a user with the request.
403
Forbidden. The API key and request syntax was valid but the server is refusing to complete the request. This can happen if you are trying to read or write to objects or properties that you do not have access to.
404
Not found. Either the request method and path supplied do not specify a known action in the API, or the object specified by the request does not exist.
412
Precondition Failed. See API in cluster mode.
429
Rate Limit Enforced. See Rate control.
500
Server error. There was a problem on OpenProcurement’s end.

Success Response

Every successful get, create, update, replace request results in response that contains data attribute. That data attribute contains full JSON object representation after the operation. If some data were generated in the result of processing (like new object IDs, or modified date) they are present in the respose.

The listing requests result in similar responses, but instead of single object in data attribute, the JSON response contains collection of objects.

Example Success Response

Here is a response that describes lot

Error Response

In the event of an error, the response body will contain an errors field at the top level. It contains an array of at least one error object, described below:

location:

Part of the request causing the error. Possible values are header and body.

name:
  • Specific header name that caused the problem (in case of header location)
  • The field name causing the error (in case of body location)
description:

Verbose (human readable) description of the error.

Example Error Response

Sample below indicates incomplete request.

Indices and tables