{
  "info": {
    "_postman_id": "fa30260a-69ce-4fff-872a-70c41b944116",
    "name": "BCS PA - C - Directory Service API AFNOR 1.2.0",
    "description": "Collection Postman pour l'API Flow Service conforme AFNOR 1.2.0, avec authentification OAuth2 client_credentials via Keycloak BCSolutions.",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
    "_exporter_id": "50267719",
    "_collection_link": "https://go.postman.co/collection/50267719-fa30260a-69ce-4fff-872a-70c41b944116?source=collection_link"
  },
  "item": [
    {
      "name": "1/ Auth - Get OAuth2 token",
      "event": [
        {
          "listen": "test",
          "script": {
            "exec": [
              "pm.test('Token response is OK', function () { pm.response.to.have.status(200); });",
              "const json = pm.response.json();",
              "if (json.access_token) { pm.collectionVariables.set('access_token', json.access_token); }"
            ],
            "type": "text/javascript",
            "packages": {},
            "requests": {}
          }
        }
      ],
      "request": {
        "method": "POST",
        "header": [
          {
            "key": "Content-Type",
            "value": "application/x-www-form-urlencoded"
          }
        ],
        "body": {
          "mode": "urlencoded",
          "urlencoded": [
            {
              "key": "grant_type",
              "value": "client_credentials",
              "type": "text"
            },
            {
              "key": "client_id",
              "value": "{{client_id}}",
              "type": "text"
            },
            {
              "key": "client_secret",
              "value": "{{client_secret}}",
              "type": "text"
            }
          ]
        },
        "url": {
          "raw": "{{oauth_token_url}}",
          "host": [
            "{{oauth_token_url}}"
          ]
        }
      },
      "response": []
    },
    {
      "name": "2a/ Search for a SIREN by SIREN code",
      "request": {
        "method": "POST",
        "header": [
          {
            "key": "Authorization",
            "value": "Bearer {{access_token}}"
          },
          {
            "key": "X-Tenant",
            "value": "{{tenantSlug}}"
          },
          {
            "key": "Content-Type",
            "value": "application/json"
          }
        ],
        "body": {
          "mode": "raw",
          "raw": "{\r\n  \"filters\": {\r\n    \"siren\": {\r\n      \"op\": \"strict\",\r\n      \"value\": \"445023427\"\r\n    }\r\n  },\r\n  \"fields\": [\r\n    \"siren\",\r\n    \"businessName\",\r\n    \"entityType\",\r\n    \"administrativeStatus\",\r\n    \"instructions\"\r\n  ],\r\n  \"limit\": 20,\r\n  \"ignore\": 0\r\n}",
          "options": {
            "raw": {
              "language": "json"
            }
          }
        },
        "url": {
          "raw": "{{tenant_public_api_url}}/v1/siren/search",
          "host": [
            "{{tenant_public_api_url}}"
          ],
          "path": [
            "v1",
            "siren",
            "search"
          ]
        }
      },
      "response": []
    },
    {
      "name": "2a/ Search for a SIREN by businessName",
      "request": {
        "method": "POST",
        "header": [
          {
            "key": "Authorization",
            "value": "Bearer {{access_token}}"
          },
          {
            "key": "X-Tenant",
            "value": "{{tenantSlug}}"
          },
          {
            "key": "Content-Type",
            "value": "application/json"
          }
        ],
        "body": {
          "mode": "raw",
          "raw": "{\r\n    \"filters\": {\r\n      \"businessName\": { \"op\": \"contains\", \"value\": \"IOPOLE\" }\r\n    },\r\n    \"limit\": 20,\r\n    \"ignore\": 0\r\n}",
          "options": {
            "raw": {
              "language": "text"
            }
          }
        },
        "url": {
          "raw": "{{tenant_public_api_url}}/v1/siren/search",
          "host": [
            "{{tenant_public_api_url}}"
          ],
          "path": [
            "v1",
            "siren",
            "search"
          ]
        }
      },
      "response": []
    },
    {
      "name": "2b/ Consult a SIREN details",
      "event": [
        {
          "listen": "test",
          "script": {
            "exec": [
              ""
            ],
            "type": "text/javascript",
            "packages": {},
            "requests": {}
          }
        }
      ],
      "protocolProfileBehavior": {
        "disableBodyPruning": true
      },
      "request": {
        "method": "GET",
        "header": [
          {
            "key": "Authorization",
            "value": "Bearer {{access_token}}"
          },
          {
            "key": "X-Tenant",
            "value": "{{tenantSlug}}",
            "type": "text"
          },
          {
            "key": "",
            "value": "",
            "type": "text"
          }
        ],
        "body": {
          "mode": "raw",
          "raw": ""
        },
        "url": {
          "raw": "{{tenant_public_api_url}}/v1/siren/code-insee:{{siren}}?fields=siren&fields=businessName&fields=entityType&fields=administrativeStatus&fields=instructions",
          "host": [
            "{{tenant_public_api_url}}"
          ],
          "path": [
            "v1",
            "siren",
            "code-insee:{{siren}}"
          ],
          "query": [
            {
              "key": "fields",
              "value": "siren"
            },
            {
              "key": "fields",
              "value": "businessName"
            },
            {
              "key": "fields",
              "value": "entityType"
            },
            {
              "key": "fields",
              "value": "administrativeStatus"
            },
            {
              "key": "fields",
              "value": "instructions"
            }
          ]
        }
      },
      "response": []
    },
    {
      "name": "3a/ Search for a SIRET by SIRET code",
      "request": {
        "method": "POST",
        "header": [
          {
            "key": "Authorization",
            "value": "Bearer {{access_token}}"
          },
          {
            "key": "X-Tenant",
            "value": "{{tenantSlug}}"
          },
          {
            "key": "Content-Type",
            "value": "application/json"
          }
        ],
        "body": {
          "mode": "raw",
          "raw": "{\r\n  \"filters\": {\r\n    \"siret\": {\r\n      \"op\": \"strict\",\r\n      \"value\": \"44502342700054\"\r\n    }\r\n  },\r\n  \"include\": [\r\n    \"siren\"\r\n  ],\r\n  \"fields\": [\r\n    \"siret\",\r\n    \"siren\",\r\n    \"name\",\r\n    \"facilityType\",\r\n    \"administrativeStatus\",\r\n    \"siretInstructions\",\r\n    \"address\"\r\n  ],\r\n  \"limit\": 20,\r\n  \"ignore\": 0\r\n}",
          "options": {
            "raw": {
              "language": "json"
            }
          }
        },
        "url": {
          "raw": "{{tenant_public_api_url}}/v1/siret/search",
          "host": [
            "{{tenant_public_api_url}}"
          ],
          "path": [
            "v1",
            "siret",
            "search"
          ]
        }
      },
      "response": []
    },
    {
      "name": "3b/ Search for a SIRET by name",
      "request": {
        "method": "POST",
        "header": [
          {
            "key": "Authorization",
            "value": "Bearer {{access_token}}"
          },
          {
            "key": "X-Tenant",
            "value": "{{tenantSlug}}"
          },
          {
            "key": "Content-Type",
            "value": "application/json"
          }
        ],
        "body": {
          "mode": "raw",
          "raw": "{\r\n    \"filters\": {\r\n      \"name\": { \"op\": \"strict\", \"value\": \"BUSINESS COMMUNICATION SOLUTIONS - 13080 - AIX-EN-PROVENCE - 1330 AV J R G GAUTIER DE LA LAUZIERE\" }\r\n    },\r\n    \"limit\": 20,\r\n    \"ignore\": 0\r\n}",
          "options": {
            "raw": {
              "language": "json"
            }
          }
        },
        "url": {
          "raw": "{{tenant_public_api_url}}/v1/siret/search",
          "host": [
            "{{tenant_public_api_url}}"
          ],
          "path": [
            "v1",
            "siret",
            "search"
          ]
        }
      },
      "response": []
    },
    {
      "name": "3c/ Consult a SIRET details",
      "protocolProfileBehavior": {
        "disableBodyPruning": true
      },
      "request": {
        "method": "GET",
        "header": [
          {
            "key": "Authorization",
            "value": "Bearer {{access_token}}"
          },
          {
            "key": "X-Tenant",
            "value": "{{tenantSlug}}"
          },
          {
            "key": "",
            "value": ""
          }
        ],
        "body": {
          "mode": "raw",
          "raw": "",
          "options": {
            "raw": {
              "language": "text"
            }
          }
        },
        "url": {
          "raw": "{{tenant_public_api_url}}/v1/siret/code-insee:{{siret}}?fields=siret&fields=siren&fields=name&fields=facilityType&fields=administrativeStatus&fields=siretInstructions&fields=address",
          "host": [
            "{{tenant_public_api_url}}"
          ],
          "path": [
            "v1",
            "siret",
            "code-insee:{{siret}}"
          ],
          "query": [
            {
              "key": "fields",
              "value": "siret"
            },
            {
              "key": "fields",
              "value": "siren"
            },
            {
              "key": "fields",
              "value": "name"
            },
            {
              "key": "fields",
              "value": "facilityType"
            },
            {
              "key": "fields",
              "value": "administrativeStatus"
            },
            {
              "key": "fields",
              "value": "siretInstructions"
            },
            {
              "key": "fields",
              "value": "address"
            }
          ]
        }
      },
      "response": []
    },
    {
      "name": "4a/ Search for a Routing code",
      "request": {
        "method": "POST",
        "header": [
          {
            "key": "Authorization",
            "value": "Bearer {{access_token}}"
          },
          {
            "key": "X-Tenant",
            "value": "{{tenantSlug}}"
          },
          {
            "key": "Content-Type",
            "value": "application/json"
          }
        ],
        "body": {
          "mode": "raw",
          "raw": "{\r\n  \"filters\": {\r\n    \"siret\": {\r\n      \"op\": \"strict\",\r\n      \"value\": \"00735010100083\"\r\n    }\r\n  },\r\n  \"include\": [\r\n    \"siren\",\r\n    \"siret\"\r\n  ],\r\n  \"fields\": [\r\n    \"siret\",\r\n    \"routingIdentifierType\",\r\n    \"routingCodeName\",\r\n    \"routingIdentifier\",\r\n    \"administrativeStatus\",\r\n    \"address\"\r\n  ],\r\n  \"limit\": 20,\r\n  \"ignore\": 0\r\n}",
          "options": {
            "raw": {
              "language": "text"
            }
          }
        },
        "url": {
          "raw": "{{tenant_public_api_url}}/v1/routing-code/search",
          "host": [
            "{{tenant_public_api_url}}"
          ],
          "path": [
            "v1",
            "routing-code",
            "search"
          ]
        }
      },
      "response": []
    },
    {
      "name": "5a/ Search for a Directory line",
      "request": {
        "method": "POST",
        "header": [
          {
            "key": "Authorization",
            "value": "Bearer {{access_token}}"
          },
          {
            "key": "X-Tenant",
            "value": "{{tenantSlug}}"
          },
          {
            "key": "Content-Type",
            "value": "application/json"
          }
        ],
        "body": {
          "mode": "raw",
          "raw": "{\r\n  \"filters\": {\r\n    \"addressingIdentifier\": {\r\n      \"op\": \"strict\",\r\n      \"value\": \"0225:007350101\"\r\n    }\r\n  },\r\n  \"fields\": [\r\n    \"addressingIdentifier\",\r\n    \"siren\",\r\n    \"siret\",\r\n    \"routingIdentifier\",\r\n    \"addressingSuffix\"\r\n  ],\r\n  \"limit\": 20,\r\n  \"ignore\": 0\r\n}",
          "options": {
            "raw": {
              "language": "text"
            }
          }
        },
        "url": {
          "raw": "{{tenant_public_api_url}}/v1/directory-line/search",
          "host": [
            "{{tenant_public_api_url}}"
          ],
          "path": [
            "v1",
            "directory-line",
            "search"
          ]
        }
      },
      "response": []
    },
    {
      "name": "Supervisor - Healthcheck",
      "request": {
        "method": "GET",
        "header": [
          {
            "key": "Authorization",
            "value": "Bearer {{access_token}}"
          },
          {
            "key": "X-Tenant",
            "value": "{{tenantSlug}}",
            "type": "text"
          }
        ],
        "url": {
          "raw": "{{tenant_public_api_url}}/v1/healthcheck",
          "host": [
            "{{tenant_public_api_url}}"
          ],
          "path": [
            "v1",
            "healthcheck"
          ]
        }
      },
      "response": []
    }
  ],
  "event": [
    {
      "listen": "prerequest",
      "script": {
        "type": "text/javascript",
        "packages": {},
        "requests": {},
        "exec": [
          ""
        ]
      }
    },
    {
      "listen": "test",
      "script": {
        "type": "text/javascript",
        "packages": {},
        "requests": {},
        "exec": [
          ""
        ]
      }
    }
  ],
  "variable": [
    {
      "key": "access_token",
      "value": ""
    }
  ]
}