Example for Contract

Contract ownership change

Let’s view transfer example for contract transfer.

Getting contract’s credentials

At first let’s get contract credentials:

PATCH /api/2.5/contracts/223251091c99415eb820553413b6aa9e/credentials?acc_token=ee9c282747ef9192c95efd1ba05309f6b1e5648c2e7738e0c2cead9f67d0a7e9a9d42b673de5b2dddf88a3885be7e428aa90a1be1c7bff8d8608f028830b08f7 HTTP/1.0
Authorization: Bearer broker
Content-Length: 12
Content-Type: application/json
Host: lb-api-sandbox.prozorro.gov.ua
DATA:
{
  "data": ""
}

Response: 200 OK
Content-Type: application/json; charset=UTF-8
{
  "access": {
    "transfer": "a74f356d32d14bc3b67a9f57f220200a",
    "token": "0af54315bf27431e9b772579357bb243"
  },
  "data": {
    "status": "active",
    "items": [
      {
        "description": "футляри до державних нагород",
        "classification": {
          "scheme": "CPV",
          "description": "Cartons",
          "id": "44617100-9"
        },
        "additionalClassifications": [
          {
            "scheme": "ДКПП",
            "id": "17.21.1",
            "description": "папір і картон гофровані, паперова й картонна тара"
          }
        ],
        "deliveryAddress": {
          "postalCode": "79000",
          "countryName": "Україна",
          "streetAddress": "вул. Банкова 1",
          "region": "м. Київ",
          "locality": "м. Київ"
        },
        "deliveryDate": {
          "startDate": "2016-03-20T18:47:47.136678+02:00",
          "endDate": "2016-03-23T18:47:47.136678+02:00"
        },
        "id": "c6c6e8ed4b1542e4bf13d3f98ec5ab59",
        "unit": {
          "code": "44617100-9",
          "name": "item"
        },
        "quantity": 5.0
      }
    ],
    "suppliers": [
      {
        "contactPoint": {
          "email": "aagt@gmail.com",
          "telephone": "+380 (322) 91-69-30",
          "name": "Андрій Олексюк"
        },
        "identifier": {
          "scheme": "UA-EDR",
          "id": "00137226",
          "uri": "http://www.sc.gov.ua/"
        },
        "name": "ДКП «Книга»",
        "address": {
          "postalCode": "79013",
          "countryName": "Україна",
          "streetAddress": "вул. Островського, 34",
          "region": "Львівська область",
          "locality": "м. Львів"
        }
      }
    ],
    "contractNumber": "contract #13111",
    "period": {
      "startDate": "2016-03-18T18:47:47.155143+02:00",
      "endDate": "2017-03-18T18:47:47.155143+02:00"
    },
    "value": {
      "currency": "UAH",
      "amount": 238.0,
      "amountNet": 237.0,
      "valueAddedTaxIncluded": true
    },
    "id": "223251091c99415eb820553413b6aa9e",
    "procuringEntity": {
      "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": "м. Київ"
      }
    },
    "dateSigned": "2019-10-25T01:00:00+03:00",
    "contractID": "UA-2016-03-18-000001-1",
    "owner": "broker",
    "awardID": "8481d7eb01694c25b18658036c236c5d",
    "dateModified": "2019-10-25T01:00:00+03:00",
    "tender_id": "6c7e283dac7e457f9046067792657bd8"
  }
}

broker is current contract’s owner.

Note that response’s access section contains a transfer key which is used to change tender ownership.

After contract’s credentials obtaining broker has to provide its customer with transfer key.

Transfer creation

First of all, you must know ID of the contract that you want to transfer.

Broker that is going to become new contract owner should create a Transfer.

POST /api/2.5/transfers HTTP/1.0
Authorization: Bearer broker3
Content-Length: 12
Content-Type: application/json
Host: lb-api-sandbox.prozorro.gov.ua
DATA:
{
  "data": {}
}

Response: 201 Created
Content-Type: application/json; charset=UTF-8
{
  "access": {
    "transfer": "069f65d2ef164b538ee94b68f3583275",
    "token": "dfb44b90693542e39191ed53473b8cb5"
  },
  "data": {
    "date": "2019-10-25T01:00:00+03:00",
    "id": "5ef74c1aed79496cbfebb12f86bcae11"
  }
}

Transfer object contains new access token and new transfer token for the object that will be transferred to new broker.

Changing contract’s owner

An ability to change contract’s ownership depends on contract’s status:

Allowed Not Allowed
active

pending

terminated

cancelled

In order to change contract’s ownership new broker should send POST request to appropriate /contracts/id/ with data section containing id of Transfer and transfer token received from customer:

POST /api/2.5/contracts/223251091c99415eb820553413b6aa9e/ownership HTTP/1.0
Authorization: Bearer broker3
Content-Length: 100
Content-Type: application/json
Host: lb-api-sandbox.prozorro.gov.ua
DATA:
{
  "data": {
    "transfer": "a74f356d32d14bc3b67a9f57f220200a",
    "id": "5ef74c1aed79496cbfebb12f86bcae11"
  }
}

Response: 200 OK
Content-Type: application/json; charset=UTF-8
{
  "data": {
    "status": "active",
    "items": [
      {
        "description": "футляри до державних нагород",
        "classification": {
          "scheme": "CPV",
          "description": "Cartons",
          "id": "44617100-9"
        },
        "additionalClassifications": [
          {
            "scheme": "ДКПП",
            "id": "17.21.1",
            "description": "папір і картон гофровані, паперова й картонна тара"
          }
        ],
        "deliveryAddress": {
          "postalCode": "79000",
          "countryName": "Україна",
          "streetAddress": "вул. Банкова 1",
          "region": "м. Київ",
          "locality": "м. Київ"
        },
        "deliveryDate": {
          "startDate": "2016-03-20T18:47:47.136678+02:00",
          "endDate": "2016-03-23T18:47:47.136678+02:00"
        },
        "id": "c6c6e8ed4b1542e4bf13d3f98ec5ab59",
        "unit": {
          "code": "44617100-9",
          "name": "item"
        },
        "quantity": 5.0
      }
    ],
    "suppliers": [
      {
        "contactPoint": {
          "email": "aagt@gmail.com",
          "telephone": "+380 (322) 91-69-30",
          "name": "Андрій Олексюк"
        },
        "identifier": {
          "scheme": "UA-EDR",
          "id": "00137226",
          "uri": "http://www.sc.gov.ua/"
        },
        "name": "ДКП «Книга»",
        "address": {
          "postalCode": "79013",
          "countryName": "Україна",
          "streetAddress": "вул. Островського, 34",
          "region": "Львівська область",
          "locality": "м. Львів"
        }
      }
    ],
    "contractNumber": "contract #13111",
    "period": {
      "startDate": "2016-03-18T18:47:47.155143+02:00",
      "endDate": "2017-03-18T18:47:47.155143+02:00"
    },
    "value": {
      "currency": "UAH",
      "amount": 238.0,
      "amountNet": 237.0,
      "valueAddedTaxIncluded": true
    },
    "id": "223251091c99415eb820553413b6aa9e",
    "procuringEntity": {
      "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": "м. Київ"
      }
    },
    "dateSigned": "2019-10-25T01:00:00+03:00",
    "contractID": "UA-2016-03-18-000001-1",
    "owner": "broker3",
    "awardID": "8481d7eb01694c25b18658036c236c5d",
    "dateModified": "2019-10-25T01:00:00+03:00",
    "tender_id": "6c7e283dac7e457f9046067792657bd8"
  }
}

Updated owner value indicates that ownership is successfully changed.

Note that new broker has to provide its customer with new transfer key (generated in Transfer object).

After Transfer is applied it stores contract path in usedFor property.

GET /api/2.5/transfers/5ef74c1aed79496cbfebb12f86bcae11 HTTP/1.0
Authorization: Bearer broker3
Host: lb-api-sandbox.prozorro.gov.ua

Response: 200 OK
Content-Type: application/json; charset=UTF-8
{
  "data": {
    "date": "2019-10-25T01:00:00+03:00",
    "id": "5ef74c1aed79496cbfebb12f86bcae11",
    "usedFor": "/contracts/223251091c99415eb820553413b6aa9e"
  }
}

Let’s try to change the contract using token received on Transfer creation:

PATCH /api/2.5/contracts/223251091c99415eb820553413b6aa9e?acc_token=dfb44b90693542e39191ed53473b8cb5 HTTP/1.0
Authorization: Bearer broker3
Content-Length: 64
Content-Type: application/json
Host: lb-api-sandbox.prozorro.gov.ua
DATA:
{
  "data": {
    "description": "broker3 now can change the contract"
  }
}

Response: 200 OK
Content-Type: application/json; charset=UTF-8
{
  "data": {
    "status": "active",
    "description": "broker3 now can change the contract",
    "items": [
      {
        "description": "футляри до державних нагород",
        "classification": {
          "scheme": "CPV",
          "description": "Cartons",
          "id": "44617100-9"
        },
        "additionalClassifications": [
          {
            "scheme": "ДКПП",
            "id": "17.21.1",
            "description": "папір і картон гофровані, паперова й картонна тара"
          }
        ],
        "deliveryAddress": {
          "postalCode": "79000",
          "countryName": "Україна",
          "streetAddress": "вул. Банкова 1",
          "region": "м. Київ",
          "locality": "м. Київ"
        },
        "deliveryDate": {
          "startDate": "2016-03-20T18:47:47.136678+02:00",
          "endDate": "2016-03-23T18:47:47.136678+02:00"
        },
        "id": "c6c6e8ed4b1542e4bf13d3f98ec5ab59",
        "unit": {
          "code": "44617100-9",
          "name": "item"
        },
        "quantity": 5.0
      }
    ],
    "suppliers": [
      {
        "contactPoint": {
          "email": "aagt@gmail.com",
          "telephone": "+380 (322) 91-69-30",
          "name": "Андрій Олексюк"
        },
        "identifier": {
          "scheme": "UA-EDR",
          "id": "00137226",
          "uri": "http://www.sc.gov.ua/"
        },
        "name": "ДКП «Книга»",
        "address": {
          "postalCode": "79013",
          "countryName": "Україна",
          "streetAddress": "вул. Островського, 34",
          "region": "Львівська область",
          "locality": "м. Львів"
        }
      }
    ],
    "contractNumber": "contract #13111",
    "period": {
      "startDate": "2016-03-18T18:47:47.155143+02:00",
      "endDate": "2017-03-18T18:47:47.155143+02:00"
    },
    "value": {
      "currency": "UAH",
      "amount": 238.0,
      "amountNet": 237.0,
      "valueAddedTaxIncluded": true
    },
    "id": "223251091c99415eb820553413b6aa9e",
    "procuringEntity": {
      "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": "м. Київ"
      }
    },
    "dateSigned": "2019-10-25T01:00:00+03:00",
    "contractID": "UA-2016-03-18-000001-1",
    "owner": "broker3",
    "awardID": "8481d7eb01694c25b18658036c236c5d",
    "dateModified": "2019-10-25T01:00:00+03:00",
    "tender_id": "6c7e283dac7e457f9046067792657bd8"
  }
}

Pay attention that only broker with appropriate accreditation level can become new owner. Otherwise broker will be forbidden from this action.

POST /api/2.5/contracts/223251091c99415eb820553413b6aa9e/ownership HTTP/1.0
Authorization: Bearer broker2
Content-Length: 100
Content-Type: application/json
Host: lb-api-sandbox.prozorro.gov.ua
DATA:
{
  "data": {
    "transfer": "a74f356d32d14bc3b67a9f57f220200a",
    "id": "5e760b0b6a1e47d08dd2277acbec53f7"
  }
}

Response: 403 Forbidden
Content-Type: application/json; charset=UTF-8
{
  "status": "error",
  "errors": [
    {
      "description": "Broker Accreditation level does not permit ownership change",
      "location": "ownership",
      "name": "accreditation"
    }
  ]
}

Also ownership change is allowed only if current owner has a special accreditation level that allows ownership change:

POST /api/2.5/contracts/223251091c99415eb820553413b6aa9e/ownership HTTP/1.0
Authorization: Bearer broker
Content-Length: 100
Content-Type: application/json
Host: lb-api-sandbox.prozorro.gov.ua
DATA:
{
  "data": {
    "transfer": "a74f356d32d14bc3b67a9f57f220200a",
    "id": "5327bcf32c0e4bb287b10ff6f32c91d3"
  }
}

Response: 403 Forbidden
Content-Type: application/json; charset=UTF-8
{
  "status": "error",
  "errors": [
    {
      "description": "Owner Accreditation level does not permit ownership change",
      "location": "ownership",
      "name": "accreditation"
    }
  ]
}