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=eyJvcGVyYXRpb25fdGltZSI6IHsiJHRpbWVzdGFtcCI6IHsidCI6IDE3NjIyNTM5OTIsICJpIjogNzd9fSwgImNsdXN0ZXJfdGltZSI6IHsiY2x1c3RlclRpbWUiOiB7IiR0aW1lc3RhbXAiOiB7InQiOiAxNzYyMjUzOTkyLCAiaSI6IDc3fX0sICJzaWduYXR1cmUiOiB7Imhhc2giOiB7IiRiaW5hcnkiOiB7ImJhc2U2NCI6ICIzcElVeTVLdlVSSEJiUzR0ZEtyYkk1YmQ4RXM9IiwgInN1YlR5cGUiOiAiMDAifX0sICJrZXlJZCI6IDc1NjY2Mjk2Njg0Njg1NTU3ODN9fX0=; Path=/
X-Content-Type-Options: nosniff
{
  "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/1dae37f349ef4bb3badb25a6dddc138e
Set-Cookie: SESSION=eyJvcGVyYXRpb25fdGltZSI6IHsiJHRpbWVzdGFtcCI6IHsidCI6IDE3NjIyNTM5OTMsICJpIjogMn19LCAiY2x1c3Rlcl90aW1lIjogeyJjbHVzdGVyVGltZSI6IHsiJHRpbWVzdGFtcCI6IHsidCI6IDE3NjIyNTM5OTMsICJpIjogMn19LCAic2lnbmF0dXJlIjogeyJoYXNoIjogeyIkYmluYXJ5IjogeyJiYXNlNjQiOiAiWTZ2SHByenRtMSt4KzZ0VnJ4c3B3NFY0dHI0PSIsICJzdWJUeXBlIjogIjAwIn19LCAia2V5SWQiOiA3NTY2NjI5NjY4NDY4NTU1NzgzfX19; Path=/
X-Content-Type-Options: nosniff
{
  "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",
    "owner": "test_sas",
    "restricted": false,
    "id": "1dae37f349ef4bb3badb25a6dddc138e"
  }
}

Documents can be added to the object:

POST /api/2.5/inspections/1dae37f349ef4bb3badb25a6dddc138e/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/1dae37f349ef4bb3badb25a6dddc138e/documents/cb9274a0ef6b40c8bf3d6c9bad2fd5cc
Set-Cookie: SESSION=eyJvcGVyYXRpb25fdGltZSI6IHsiJHRpbWVzdGFtcCI6IHsidCI6IDE3NjIyNTM5OTMsICJpIjogNH19LCAiY2x1c3Rlcl90aW1lIjogeyJjbHVzdGVyVGltZSI6IHsiJHRpbWVzdGFtcCI6IHsidCI6IDE3NjIyNTM5OTMsICJpIjogNH19LCAic2lnbmF0dXJlIjogeyJoYXNoIjogeyIkYmluYXJ5IjogeyJiYXNlNjQiOiAiWTZ2SHByenRtMSt4KzZ0VnJ4c3B3NFY0dHI0PSIsICJzdWJUeXBlIjogIjAwIn19LCAia2V5SWQiOiA3NTY2NjI5NjY4NDY4NTU1NzgzfX19; Path=/
X-Content-Type-Options: nosniff
{
  "data": {
    "id": "cb9274a0ef6b40c8bf3d6c9bad2fd5cc",
    "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/1dae37f349ef4bb3badb25a6dddc138e/documents/cb9274a0ef6b40c8bf3d6c9bad2fd5cc 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=eyJvcGVyYXRpb25fdGltZSI6IHsiJHRpbWVzdGFtcCI6IHsidCI6IDE3NjIyNTM5OTMsICJpIjogNn19LCAiY2x1c3Rlcl90aW1lIjogeyJjbHVzdGVyVGltZSI6IHsiJHRpbWVzdGFtcCI6IHsidCI6IDE3NjIyNTM5OTMsICJpIjogNn19LCAic2lnbmF0dXJlIjogeyJoYXNoIjogeyIkYmluYXJ5IjogeyJiYXNlNjQiOiAiWTZ2SHByenRtMSt4KzZ0VnJ4c3B3NFY0dHI0PSIsICJzdWJUeXBlIjogIjAwIn19LCAia2V5SWQiOiA3NTY2NjI5NjY4NDY4NTU1NzgzfX19; Path=/
X-Content-Type-Options: nosniff
{
  "data": {
    "id": "cb9274a0ef6b40c8bf3d6c9bad2fd5cc",
    "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:02: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/1dae37f349ef4bb3badb25a6dddc138e 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=eyJvcGVyYXRpb25fdGltZSI6IHsiJHRpbWVzdGFtcCI6IHsidCI6IDE3NjIyNTM5OTMsICJpIjogOH19LCAiY2x1c3Rlcl90aW1lIjogeyJjbHVzdGVyVGltZSI6IHsiJHRpbWVzdGFtcCI6IHsidCI6IDE3NjIyNTM5OTMsICJpIjogOH19LCAic2lnbmF0dXJlIjogeyJoYXNoIjogeyIkYmluYXJ5IjogeyJiYXNlNjQiOiAiWTZ2SHByenRtMSt4KzZ0VnJ4c3B3NFY0dHI0PSIsICJzdWJUeXBlIjogIjAwIn19LCAia2V5SWQiOiA3NTY2NjI5NjY4NDY4NTU1NzgzfX19; Path=/
X-Content-Type-Options: nosniff
{
  "data": {
    "monitoring_ids": [
      "a6b2b18977f24277b238c7b7a5342b1d",
      "580997bb06674235801d75f2f6e6c6c6"
    ],
    "description": "I regretted my decision",
    "documents": [
      {
        "id": "cb9274a0ef6b40c8bf3d6c9bad2fd5cc",
        "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": "cb9274a0ef6b40c8bf3d6c9bad2fd5cc",
        "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:02: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",
    "owner": "test_sas",
    "restricted": false,
    "id": "1dae37f349ef4bb3badb25a6dddc138e"
  }
}

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/3ac2d623a26f426ab9e1f5d7ed173081
Set-Cookie: SESSION=eyJvcGVyYXRpb25fdGltZSI6IHsiJHRpbWVzdGFtcCI6IHsidCI6IDE3NjIyNTM5OTMsICJpIjogMTJ9fSwgImNsdXN0ZXJfdGltZSI6IHsiY2x1c3RlclRpbWUiOiB7IiR0aW1lc3RhbXAiOiB7InQiOiAxNzYyMjUzOTkzLCAiaSI6IDEyfX0sICJzaWduYXR1cmUiOiB7Imhhc2giOiB7IiRiaW5hcnkiOiB7ImJhc2U2NCI6ICJZNnZIcHJ6dG0xK3grNnRWcnhzcHc0VjR0cjQ9IiwgInN1YlR5cGUiOiAiMDAifX0sICJrZXlJZCI6IDc1NjY2Mjk2Njg0Njg1NTU3ODN9fX0=; Path=/
X-Content-Type-Options: nosniff
{
  "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": "84e0bb247f58474097b67ba60358f869",
        "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",
    "owner": "test_sas",
    "restricted": true,
    "id": "3ac2d623a26f426ab9e1f5d7ed173081"
  }
}

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/3ac2d623a26f426ab9e1f5d7ed173081 HTTP/1.0
Authorization: Basic dGVzdF9zYXM6dGVzdF9zYXNfdG9rZW4=
Host: audit-api-sandbox.prozorro.gov.ua

Response: 200 OK
Content-Type: application/json
Set-Cookie: SESSION=eyJvcGVyYXRpb25fdGltZSI6IHsiJHRpbWVzdGFtcCI6IHsidCI6IDE3NjIyNTM5OTMsICJpIjogMTJ9fSwgImNsdXN0ZXJfdGltZSI6IHsiY2x1c3RlclRpbWUiOiB7IiR0aW1lc3RhbXAiOiB7InQiOiAxNzYyMjUzOTkzLCAiaSI6IDEyfX0sICJzaWduYXR1cmUiOiB7Imhhc2giOiB7IiRiaW5hcnkiOiB7ImJhc2U2NCI6ICJZNnZIcHJ6dG0xK3grNnRWcnhzcHc0VjR0cjQ9IiwgInN1YlR5cGUiOiAiMDAifX0sICJrZXlJZCI6IDc1NjY2Mjk2Njg0Njg1NTU3ODN9fX0=; Path=/
X-Content-Type-Options: nosniff
{
  "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": "84e0bb247f58474097b67ba60358f869",
        "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",
    "owner": "test_sas",
    "restricted": true,
    "id": "3ac2d623a26f426ab9e1f5d7ed173081"
  }
}

Let’s look at inspection with role broker:

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

Response: 200 OK
Content-Type: application/json
Set-Cookie: SESSION=eyJvcGVyYXRpb25fdGltZSI6IHsiJHRpbWVzdGFtcCI6IHsidCI6IDE3NjIyNTM5OTMsICJpIjogMTJ9fSwgImNsdXN0ZXJfdGltZSI6IHsiY2x1c3RlclRpbWUiOiB7IiR0aW1lc3RhbXAiOiB7InQiOiAxNzYyMjUzOTkzLCAiaSI6IDEyfX0sICJzaWduYXR1cmUiOiB7Imhhc2giOiB7IiRiaW5hcnkiOiB7ImJhc2U2NCI6ICJZNnZIcHJ6dG0xK3grNnRWcnhzcHc0VjR0cjQ9IiwgInN1YlR5cGUiOiAiMDAifX0sICJrZXlJZCI6IDc1NjY2Mjk2Njg0Njg1NTU3ODN9fX0=; Path=/
X-Content-Type-Options: nosniff
{
  "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": "84e0bb247f58474097b67ba60358f869",
        "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",
    "owner": "test_sas",
    "restricted": true,
    "id": "3ac2d623a26f426ab9e1f5d7ed173081"
  }
}

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/3ac2d623a26f426ab9e1f5d7ed173081 HTTP/1.0
Authorization: Basic YnJva2VyOmJyb2tlcg==
Host: audit-api-sandbox.prozorro.gov.ua

Response: 200 OK
Content-Type: application/json
Set-Cookie: SESSION=eyJvcGVyYXRpb25fdGltZSI6IHsiJHRpbWVzdGFtcCI6IHsidCI6IDE3NjIyNTM5OTMsICJpIjogMTJ9fSwgImNsdXN0ZXJfdGltZSI6IHsiY2x1c3RlclRpbWUiOiB7IiR0aW1lc3RhbXAiOiB7InQiOiAxNzYyMjUzOTkzLCAiaSI6IDEyfX0sICJzaWduYXR1cmUiOiB7Imhhc2giOiB7IiRiaW5hcnkiOiB7ImJhc2U2NCI6ICJZNnZIcHJ6dG0xK3grNnRWcnhzcHc0VjR0cjQ9IiwgInN1YlR5cGUiOiAiMDAifX0sICJrZXlJZCI6IDc1NjY2Mjk2Njg0Njg1NTU3ODN9fX0=; Path=/
X-Content-Type-Options: nosniff
{
  "data": {
    "monitoring_ids": [
      "038bf8155961464ba5beac25fac2550e",
      "799a8c08b9e441bcb191d062ca77f8dd"
    ],
    "description": "Приховано",
    "documents": [
      {
        "id": "84e0bb247f58474097b67ba60358f869",
        "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",
    "owner": "test_sas",
    "restricted": true,
    "id": "3ac2d623a26f426ab9e1f5d7ed173081"
  }
}