Tutorial

Here is the list of inspections:

GET /api/2.5/inspections HTTP/1.0
Authorization: Basic dGVzdF9zYXM6dGVzdF9zYXNfdG9rZW4=
Host: audit-api-sandbox.prozorro.gov.ua

Response: 200 OK
Content-Type: application/json
Set-Cookie: SESSION=eyJvcGVyYXRpb25fdGltZSI6IHsiJHRpbWVzdGFtcCI6IHsidCI6IDE3MDg1Mjc4ODQsICJpIjogMTF9fSwgImNsdXN0ZXJfdGltZSI6IHsiY2x1c3RlclRpbWUiOiB7IiR0aW1lc3RhbXAiOiB7InQiOiAxNzA4NTI3ODg0LCAiaSI6IDExfX0sICJzaWduYXR1cmUiOiB7Imhhc2giOiB7IiRiaW5hcnkiOiB7ImJhc2U2NCI6ICJNSnZNZHRia1FabGNVK1hvaTgxR1FxT0JkVFk9IiwgInN1YlR5cGUiOiAiMDAifX0sICJrZXlJZCI6IDczMzMxNzk4MzkyNDA3MzI2Nzd9fX0=; Path=/
{
  "data": [],
  "next_page": {
    "offset": "",
    "path": "/api/2.5/inspections",
    "uri": "http://audit-api-sandbox.prozorro.gov.ua/api/2.5/inspections"
  }
}

There are no inspections, so let’s post one:

POST /api/2.5/inspections HTTP/1.0
Authorization: Basic dGVzdF9zYXM6dGVzdF9zYXNfdG9rZW4=
Content-Length: 291
Content-Type: application/json
Host: audit-api-sandbox.prozorro.gov.ua
DATA:
{
  "data": {
    "monitoring_ids": [
      "a6b2b18977f24277b238c7b7a5342b1d",
      "580997bb06674235801d75f2f6e6c6c6",
      "2c5cc4a289d747a5b8dacd72adaea4d9"
    ],
    "description": "Inspection is an official visit to a building or organization to check that everything is satisfactory and that rules are being obeyed"
  }
}

Response: 201 Created
Content-Type: application/json
Location: http://audit-api-sandbox.prozorro.gov.ua/api/2.5/inspections/71fbf55e244d42ca89e1ad68e4bf4d4a
Set-Cookie: SESSION=eyJvcGVyYXRpb25fdGltZSI6IHsiJHRpbWVzdGFtcCI6IHsidCI6IDE3MDg1Mjc4ODQsICJpIjogMTN9fSwgImNsdXN0ZXJfdGltZSI6IHsiY2x1c3RlclRpbWUiOiB7IiR0aW1lc3RhbXAiOiB7InQiOiAxNzA4NTI3ODg0LCAiaSI6IDEzfX0sICJzaWduYXR1cmUiOiB7Imhhc2giOiB7IiRiaW5hcnkiOiB7ImJhc2U2NCI6ICJNSnZNZHRia1FabGNVK1hvaTgxR1FxT0JkVFk9IiwgInN1YlR5cGUiOiAiMDAifX0sICJrZXlJZCI6IDczMzMxNzk4MzkyNDA3MzI2Nzd9fX0=; Path=/
{
  "data": {
    "monitoring_ids": [
      "a6b2b18977f24277b238c7b7a5342b1d",
      "580997bb06674235801d75f2f6e6c6c6",
      "2c5cc4a289d747a5b8dacd72adaea4d9"
    ],
    "description": "Inspection is an official visit to a building or organization to check that everything is satisfactory and that rules are being obeyed",
    "inspection_id": "UA-I-2018-01-01-000001",
    "dateModified": "2018-01-01T02:00:00+02:00",
    "dateCreated": "2018-01-01T02:00:00+02:00",
    "restricted": false,
    "id": "71fbf55e244d42ca89e1ad68e4bf4d4a"
  }
}

Documents can be added to the object:

POST /api/2.5/inspections/71fbf55e244d42ca89e1ad68e4bf4d4a/documents HTTP/1.0
Authorization: Basic dGVzdF9zYXM6dGVzdF9zYXNfdG9rZW4=
Content-Length: 314
Content-Type: application/json
Host: audit-api-sandbox.prozorro.gov.ua
DATA:
{
  "data": {
    "title": "doc.txt",
    "url": "http://public-docs-sandbox.prozorro.gov.ua/get/cb24ad29b9a2463eacf26ea75a1dcec7?Signature=oI4gndGi1vcs9AfrrpTeTDDYJYYdNI1oILD%2F76fIfuSJSwPNZDOfEIwsBdjLNEixSTn%2Fl9krnPi9SI0ksGz1Dw%3D%3D&KeyID=a8968c46",
    "hash": "md5:00000000000000000000000000000000",
    "format": "plain/text"
  }
}

Response: 201 Created
Content-Type: application/json
Location: http://audit-api-sandbox.prozorro.gov.ua/api/2.5/inspections/71fbf55e244d42ca89e1ad68e4bf4d4a/documents/890c43abacea46eb90be31bf6c617693
Set-Cookie: SESSION=eyJvcGVyYXRpb25fdGltZSI6IHsiJHRpbWVzdGFtcCI6IHsidCI6IDE3MDg1Mjc4ODQsICJpIjogMTV9fSwgImNsdXN0ZXJfdGltZSI6IHsiY2x1c3RlclRpbWUiOiB7IiR0aW1lc3RhbXAiOiB7InQiOiAxNzA4NTI3ODg0LCAiaSI6IDE1fX0sICJzaWduYXR1cmUiOiB7Imhhc2giOiB7IiRiaW5hcnkiOiB7ImJhc2U2NCI6ICJNSnZNZHRia1FabGNVK1hvaTgxR1FxT0JkVFk9IiwgInN1YlR5cGUiOiAiMDAifX0sICJrZXlJZCI6IDczMzMxNzk4MzkyNDA3MzI2Nzd9fX0=; Path=/
{
  "data": {
    "id": "890c43abacea46eb90be31bf6c617693",
    "hash": "md5:00000000000000000000000000000000",
    "title": "doc.txt",
    "format": "plain/text",
    "url": "http://public-docs-sandbox.prozorro.gov.ua/get/cb24ad29b9a2463eacf26ea75a1dcec7?Signature=j1Cv5NxBsfB3dV27nkGHdIEMnjg5V%2FuSAvWqNcSGgENCwOQR%2FFToKwGvmhDm4uSct3rGJwDQg5%2FMGpcIS2iCAQ%253D%253D&KeyID=a8968c46",
    "datePublished": "2018-01-01T02:01:00+02:00",
    "dateModified": "2018-01-01T02:01:00+02:00",
    "author": "monitoring_owner"
  }
}

Documents can be changed:

PUT /api/2.5/inspections/71fbf55e244d42ca89e1ad68e4bf4d4a/documents/890c43abacea46eb90be31bf6c617693 HTTP/1.0
Authorization: Basic dGVzdF9zYXM6dGVzdF9zYXNfdG9rZW4=
Content-Length: 326
Content-Type: application/json
Host: audit-api-sandbox.prozorro.gov.ua
DATA:
{
  "data": {
    "title": "doc(1).json",
    "url": "http://public-docs-sandbox.prozorro.gov.ua/get/b3305743561740678519d95d24bffbd2?Signature=9qiC%2B9rFYIsSmA8mDWGNdUq0Q5P5ntUKA8WrS%2Fv6fsg0AGWgoTrhVVlKV2JaVldfksh26UeCj5R%2Fa49pat59DA%3D%3D&KeyID=a8968c46",
    "hash": "md5:00000000000000000000000000000000",
    "format": "application/json"
  }
}

Response: 200 OK
Content-Type: application/json
Set-Cookie: SESSION=eyJvcGVyYXRpb25fdGltZSI6IHsiJHRpbWVzdGFtcCI6IHsidCI6IDE3MDg1Mjc4ODQsICJpIjogMTd9fSwgImNsdXN0ZXJfdGltZSI6IHsiY2x1c3RlclRpbWUiOiB7IiR0aW1lc3RhbXAiOiB7InQiOiAxNzA4NTI3ODg0LCAiaSI6IDE3fX0sICJzaWduYXR1cmUiOiB7Imhhc2giOiB7IiRiaW5hcnkiOiB7ImJhc2U2NCI6ICJNSnZNZHRia1FabGNVK1hvaTgxR1FxT0JkVFk9IiwgInN1YlR5cGUiOiAiMDAifX0sICJrZXlJZCI6IDczMzMxNzk4MzkyNDA3MzI2Nzd9fX0=; Path=/
{
  "data": {
    "id": "890c43abacea46eb90be31bf6c617693",
    "hash": "md5:00000000000000000000000000000000",
    "title": "doc(1).json",
    "format": "application/json",
    "url": "http://public-docs-sandbox.prozorro.gov.ua/get/b3305743561740678519d95d24bffbd2?Signature=0k6hFG1yXQaRPGuG%252BHkqNX7cwClU9%2F6qDvOSfFqqyWQjtX1S476zNcFCxvC8LwS65sU7PdPYnI1cySaf8iB3AQ%253D%253D&KeyID=a8968c46",
    "datePublished": "2018-01-01T02:01:00+02:00",
    "dateModified": "2018-01-01T02:02:00+02:00",
    "author": "monitoring_owner"
  }
}

And the object itself can be changed:

PATCH /api/2.5/inspections/71fbf55e244d42ca89e1ad68e4bf4d4a HTTP/1.0
Authorization: Basic dGVzdF9zYXM6dGVzdF9zYXNfdG9rZW4=
Content-Length: 144
Content-Type: application/json
Host: audit-api-sandbox.prozorro.gov.ua
DATA:
{
  "data": {
    "description": "I regretted my decision",
    "monitoring_ids": [
      "a6b2b18977f24277b238c7b7a5342b1d",
      "580997bb06674235801d75f2f6e6c6c6"
    ]
  }
}

Response: 200 OK
Content-Type: application/json
Set-Cookie: SESSION=eyJvcGVyYXRpb25fdGltZSI6IHsiJHRpbWVzdGFtcCI6IHsidCI6IDE3MDg1Mjc4ODQsICJpIjogMTl9fSwgImNsdXN0ZXJfdGltZSI6IHsiY2x1c3RlclRpbWUiOiB7IiR0aW1lc3RhbXAiOiB7InQiOiAxNzA4NTI3ODg0LCAiaSI6IDE5fX0sICJzaWduYXR1cmUiOiB7Imhhc2giOiB7IiRiaW5hcnkiOiB7ImJhc2U2NCI6ICJNSnZNZHRia1FabGNVK1hvaTgxR1FxT0JkVFk9IiwgInN1YlR5cGUiOiAiMDAifX0sICJrZXlJZCI6IDczMzMxNzk4MzkyNDA3MzI2Nzd9fX0=; Path=/
{
  "data": {
    "monitoring_ids": [
      "a6b2b18977f24277b238c7b7a5342b1d",
      "580997bb06674235801d75f2f6e6c6c6"
    ],
    "description": "I regretted my decision",
    "documents": [
      {
        "id": "890c43abacea46eb90be31bf6c617693",
        "hash": "md5:00000000000000000000000000000000",
        "title": "doc.txt",
        "format": "plain/text",
        "url": "http://public-docs-sandbox.prozorro.gov.ua/get/cb24ad29b9a2463eacf26ea75a1dcec7?Signature=j1Cv5NxBsfB3dV27nkGHdIEMnjg5V%2FuSAvWqNcSGgENCwOQR%2FFToKwGvmhDm4uSct3rGJwDQg5%2FMGpcIS2iCAQ%253D%253D&KeyID=a8968c46",
        "datePublished": "2018-01-01T02:01:00+02:00",
        "dateModified": "2018-01-01T02:01:00+02:00",
        "author": "monitoring_owner"
      },
      {
        "id": "890c43abacea46eb90be31bf6c617693",
        "hash": "md5:00000000000000000000000000000000",
        "title": "doc(1).json",
        "format": "application/json",
        "url": "http://public-docs-sandbox.prozorro.gov.ua/get/b3305743561740678519d95d24bffbd2?Signature=0k6hFG1yXQaRPGuG%252BHkqNX7cwClU9%2F6qDvOSfFqqyWQjtX1S476zNcFCxvC8LwS65sU7PdPYnI1cySaf8iB3AQ%253D%253D&KeyID=a8968c46",
        "datePublished": "2018-01-01T02:01:00+02:00",
        "dateModified": "2018-01-01T02:02:00+02:00",
        "author": "monitoring_owner"
      }
    ],
    "inspection_id": "UA-I-2018-01-01-000001",
    "dateModified": "2018-01-01T02:03:00+02:00",
    "dateCreated": "2018-01-01T02:00:00+02:00",
    "restricted": false,
    "id": "71fbf55e244d42ca89e1ad68e4bf4d4a"
  }
}

Configuration

restricted

Tenders have configuration that indicates whether the tender has restricted access. This configuration relates to monitoring too.

During monitoring creation configuration restricted is moving from tender.

During inspection creation, if there are at least one monitoring in monitoring_ids with restricted: True value, this configuration is moving to inspection as restricted: True. In others cases restricted will have value False.

Let’s create inspection for monitoring with restricted: True value:

POST /api/2.5/inspections HTTP/1.0
Authorization: Basic dGVzdF9zYXM6dGVzdF9zYXNfdG9rZW4=
Content-Length: 588
Content-Type: application/json
Host: audit-api-sandbox.prozorro.gov.ua
DATA:
{
  "data": {
    "monitoring_ids": [
      "038bf8155961464ba5beac25fac2550e",
      "799a8c08b9e441bcb191d062ca77f8dd"
    ],
    "description": "Inspection is an official visit to a building or organization to check that everything is satisfactory and that rules are being obeyed",
    "documents": [
      {
        "title": "lorem.doc",
        "url": "http://public-docs-sandbox.prozorro.gov.ua/get/d1a483cac3a945609d512dca07a0e6fc?Signature=1hiJDXcZwJ2b%2FU0QN8F5nY%2F3AwDMG4dF%2BClaoIKi2YhhxgSyCYmJ0aCYrAtsKZxkkg11T8znV3vY0Wuw78TzAQ%3D%3D&KeyID=a8968c46",
        "hash": "md5:00000000000000000000000000000000",
        "format": "application/msword"
      }
    ]
  }
}

Response: 201 Created
Content-Type: application/json
Location: http://audit-api-sandbox.prozorro.gov.ua/api/2.5/inspections/4feeb2bea7234750a2469ac78f0feebd
Set-Cookie: SESSION=eyJvcGVyYXRpb25fdGltZSI6IHsiJHRpbWVzdGFtcCI6IHsidCI6IDE3MDg1Mjc4ODQsICJpIjogNDN9fSwgImNsdXN0ZXJfdGltZSI6IHsiY2x1c3RlclRpbWUiOiB7IiR0aW1lc3RhbXAiOiB7InQiOiAxNzA4NTI3ODg0LCAiaSI6IDQzfX0sICJzaWduYXR1cmUiOiB7Imhhc2giOiB7IiRiaW5hcnkiOiB7ImJhc2U2NCI6ICJNSnZNZHRia1FabGNVK1hvaTgxR1FxT0JkVFk9IiwgInN1YlR5cGUiOiAiMDAifX0sICJrZXlJZCI6IDczMzMxNzk4MzkyNDA3MzI2Nzd9fX0=; Path=/
{
  "data": {
    "monitoring_ids": [
      "038bf8155961464ba5beac25fac2550e",
      "799a8c08b9e441bcb191d062ca77f8dd"
    ],
    "description": "Inspection is an official visit to a building or organization to check that everything is satisfactory and that rules are being obeyed",
    "documents": [
      {
        "id": "04d8f560fd904fee915be81626b64263",
        "hash": "md5:00000000000000000000000000000000",
        "title": "lorem.doc",
        "format": "application/msword",
        "url": "http://public-docs-sandbox.prozorro.gov.ua/get/d1a483cac3a945609d512dca07a0e6fc?Signature=1hiJDXcZwJ2b%2FU0QN8F5nY%2F3AwDMG4dF%2BClaoIKi2YhhxgSyCYmJ0aCYrAtsKZxkkg11T8znV3vY0Wuw78TzAQ%3D%3D&KeyID=a8968c46",
        "datePublished": "2018-01-01T02:00:00+02:00",
        "dateModified": "2018-01-01T02:00:00+02:00",
        "author": "monitoring_owner"
      }
    ],
    "inspection_id": "UA-I-2018-01-01-000001",
    "dateModified": "2018-01-01T02:00:00+02:00",
    "dateCreated": "2018-01-01T02:00:00+02:00",
    "restricted": true,
    "id": "4feeb2bea7234750a2469ac78f0feebd"
  }
}

Some fields will be masked depends on restricted configuration.

List of inspection masked fields:

path

value

$.description

Приховано

$.documents[*].title

Приховано

$.documents[*].title_ru

Приховано

$.documents[*].title_en

Hidden

$.documents[*].url

Приховано

Let’s look at inspection with role SAS:

GET /api/2.5/inspections/4feeb2bea7234750a2469ac78f0feebd HTTP/1.0
Authorization: Basic dGVzdF9zYXM6dGVzdF9zYXNfdG9rZW4=
Host: audit-api-sandbox.prozorro.gov.ua

Response: 200 OK
Content-Type: application/json
Set-Cookie: SESSION=eyJvcGVyYXRpb25fdGltZSI6IHsiJHRpbWVzdGFtcCI6IHsidCI6IDE3MDg1Mjc4ODQsICJpIjogNDN9fSwgImNsdXN0ZXJfdGltZSI6IHsiY2x1c3RlclRpbWUiOiB7IiR0aW1lc3RhbXAiOiB7InQiOiAxNzA4NTI3ODg0LCAiaSI6IDQzfX0sICJzaWduYXR1cmUiOiB7Imhhc2giOiB7IiRiaW5hcnkiOiB7ImJhc2U2NCI6ICJNSnZNZHRia1FabGNVK1hvaTgxR1FxT0JkVFk9IiwgInN1YlR5cGUiOiAiMDAifX0sICJrZXlJZCI6IDczMzMxNzk4MzkyNDA3MzI2Nzd9fX0=; Path=/
{
  "data": {
    "monitoring_ids": [
      "038bf8155961464ba5beac25fac2550e",
      "799a8c08b9e441bcb191d062ca77f8dd"
    ],
    "description": "Inspection is an official visit to a building or organization to check that everything is satisfactory and that rules are being obeyed",
    "documents": [
      {
        "id": "04d8f560fd904fee915be81626b64263",
        "hash": "md5:00000000000000000000000000000000",
        "title": "lorem.doc",
        "format": "application/msword",
        "url": "http://public-docs-sandbox.prozorro.gov.ua/get/d1a483cac3a945609d512dca07a0e6fc?Signature=1hiJDXcZwJ2b%2FU0QN8F5nY%2F3AwDMG4dF%2BClaoIKi2YhhxgSyCYmJ0aCYrAtsKZxkkg11T8znV3vY0Wuw78TzAQ%3D%3D&KeyID=a8968c46",
        "datePublished": "2018-01-01T02:00:00+02:00",
        "dateModified": "2018-01-01T02:00:00+02:00",
        "author": "monitoring_owner"
      }
    ],
    "inspection_id": "UA-I-2018-01-01-000001",
    "dateModified": "2018-01-01T02:00:00+02:00",
    "dateCreated": "2018-01-01T02:00:00+02:00",
    "restricted": true,
    "id": "4feeb2bea7234750a2469ac78f0feebd"
  }
}

Let’s look at inspection with role broker:

GET /api/2.5/inspections/4feeb2bea7234750a2469ac78f0feebd HTTP/1.0
Authorization: Basic YnJva2Vycjpicm9rZXJy
Host: audit-api-sandbox.prozorro.gov.ua

Response: 200 OK
Content-Type: application/json
Set-Cookie: SESSION=eyJvcGVyYXRpb25fdGltZSI6IHsiJHRpbWVzdGFtcCI6IHsidCI6IDE3MDg1Mjc4ODQsICJpIjogNDN9fSwgImNsdXN0ZXJfdGltZSI6IHsiY2x1c3RlclRpbWUiOiB7IiR0aW1lc3RhbXAiOiB7InQiOiAxNzA4NTI3ODg0LCAiaSI6IDQzfX0sICJzaWduYXR1cmUiOiB7Imhhc2giOiB7IiRiaW5hcnkiOiB7ImJhc2U2NCI6ICJNSnZNZHRia1FabGNVK1hvaTgxR1FxT0JkVFk9IiwgInN1YlR5cGUiOiAiMDAifX0sICJrZXlJZCI6IDczMzMxNzk4MzkyNDA3MzI2Nzd9fX0=; Path=/
{
  "data": {
    "monitoring_ids": [
      "038bf8155961464ba5beac25fac2550e",
      "799a8c08b9e441bcb191d062ca77f8dd"
    ],
    "description": "Inspection is an official visit to a building or organization to check that everything is satisfactory and that rules are being obeyed",
    "documents": [
      {
        "id": "04d8f560fd904fee915be81626b64263",
        "hash": "md5:00000000000000000000000000000000",
        "title": "lorem.doc",
        "format": "application/msword",
        "url": "http://public-docs-sandbox.prozorro.gov.ua/get/d1a483cac3a945609d512dca07a0e6fc?Signature=1hiJDXcZwJ2b%2FU0QN8F5nY%2F3AwDMG4dF%2BClaoIKi2YhhxgSyCYmJ0aCYrAtsKZxkkg11T8znV3vY0Wuw78TzAQ%3D%3D&KeyID=a8968c46",
        "datePublished": "2018-01-01T02:00:00+02:00",
        "dateModified": "2018-01-01T02:00:00+02:00",
        "author": "monitoring_owner"
      }
    ],
    "inspection_id": "UA-I-2018-01-01-000001",
    "dateModified": "2018-01-01T02:00:00+02:00",
    "dateCreated": "2018-01-01T02:00:00+02:00",
    "restricted": true,
    "id": "4feeb2bea7234750a2469ac78f0feebd"
  }
}

Let’s look at inspection as unauthorized user or as broker who doesn’t have accreditation to see restricted fields:

GET /api/2.5/inspections/4feeb2bea7234750a2469ac78f0feebd HTTP/1.0
Authorization: Basic YnJva2VyOmJyb2tlcg==
Host: audit-api-sandbox.prozorro.gov.ua

Response: 200 OK
Content-Type: application/json
Set-Cookie: SESSION=eyJvcGVyYXRpb25fdGltZSI6IHsiJHRpbWVzdGFtcCI6IHsidCI6IDE3MDg1Mjc4ODQsICJpIjogNDN9fSwgImNsdXN0ZXJfdGltZSI6IHsiY2x1c3RlclRpbWUiOiB7IiR0aW1lc3RhbXAiOiB7InQiOiAxNzA4NTI3ODg0LCAiaSI6IDQzfX0sICJzaWduYXR1cmUiOiB7Imhhc2giOiB7IiRiaW5hcnkiOiB7ImJhc2U2NCI6ICJNSnZNZHRia1FabGNVK1hvaTgxR1FxT0JkVFk9IiwgInN1YlR5cGUiOiAiMDAifX0sICJrZXlJZCI6IDczMzMxNzk4MzkyNDA3MzI2Nzd9fX0=; Path=/
{
  "data": {
    "monitoring_ids": [
      "038bf8155961464ba5beac25fac2550e",
      "799a8c08b9e441bcb191d062ca77f8dd"
    ],
    "description": "Приховано",
    "documents": [
      {
        "id": "04d8f560fd904fee915be81626b64263",
        "hash": "md5:00000000000000000000000000000000",
        "title": "Приховано",
        "format": "application/msword",
        "url": "Приховано",
        "datePublished": "2018-01-01T02:00:00+02:00",
        "dateModified": "2018-01-01T02:00:00+02:00",
        "author": "monitoring_owner"
      }
    ],
    "inspection_id": "UA-I-2018-01-01-000001",
    "dateModified": "2018-01-01T02:00:00+02:00",
    "dateCreated": "2018-01-01T02:00:00+02:00",
    "restricted": true,
    "id": "4feeb2bea7234750a2469ac78f0feebd"
  }
}