Skip to content

Requests Quickstart


Overview

This is a quickstart guide for making classification requests to the Fidescls API.

Prerequisites

It is assumed that you've got the Fidescls API server up and running. If this is not the case, check out the Quickstart Overview to get up and running.

Classification

Classification requests have the following commonalities:

  • The requests are made to the /classify end point
  • The requests are POST requests with a JSON payload

For more information about the classification interface contracts, see the classifiers development documentation as well as the API docs.

Context Classification

See the classifiers guide to get more information about the Fidecls context classification paradigm.

Postman Collection

If you have access to Postman and would like to use it to test/experiment with the API, the Fidescls Postman Collection can be used as a great place to start.

Example Requests

To make a context classification request to the API, a POST request to the localhost:8765/text/classify endpoint with a JSON payload of either of the following formats (single string vs list of strings).

Single string data

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
{
    "context": {
        "data": "email_address",
        "method": "similarity",
        "method_params": {
            "possible_targets": [
                "user.derived.identifiable.device.ip_address",
                "user.provided.identifiable.financial.account_number",
                "user.provided.identifiable.contact.email",
                "user.provided.identifiable.contact.phone_number",
                "account.contact.street",
                "account.contact.city",
                "account.contact.state",
                "account.contact.country",
                "account.contact.postal_code"
            ],
            "top_n": 1,
            "remove_stop_words": false
        }
    }
}

The response to the above request payload will be similar to the following:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
{
  "context": [
    {
      "input": "email address",
      "labels": [
        {
          "label": "user provided identifiable contact email",
          "score": 0.791374585498101,
          "position_start": null,
          "position_end": null
        }
      ]
    }
  ]
}

List of strings data

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
{
    "context": {
        "data": [
            "email_address",
            "phone_num",
            "credit_card"
            ],
        "method": "similarity",
        "method_params": {
            "possible_targets": [
                "user.derived.identifiable.device.ip_address",
                "user.provided.identifiable.financial.account_number",
                "user.provided.identifiable.contact.email",
                "user.provided.identifiable.contact.phone_number",
                "account.contact.street",
                "account.contact.city",
                "account.contact.state",
                "account.contact.country",
                "account.contact.postal_code"
            ],
            "top_n": 2,
            "remove_stop_words": false
        }
    }
}

The response to the above request payload will be similar to the following:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
{
  "context": [{
      "input": "email address",
      "labels": [{
          "label": "user provided identifiable contact email",
          "score": 0.791374585498101,
          "position_start": null,
          "position_end": null
        },
        {
          "label": "account contact postal code",
          "score": 0.7402522077965934,
          "position_start": null,
          "position_end": null
        }
      ]
    },
    {
      "input": "phone num",
      "labels": [{
          "label": "user provided identifiable contact phone number",
          "score": 0.5770164988785474,
          "position_start": null,
          "position_end": null
        },
        {
          "label": "account contact postal code",
          "score": 0.44817613132976103,
          "position_start": null,
          "position_end": null
        }
      ]
    },
    {
      "input": "credit card",
      "labels": [{
          "label": "user provided identifiable financial account number",
          "score": 0.5742921242220389,
          "position_start": null,
          "position_end": null
        },
        {
          "label": "account contact postal code",
          "score": 0.5587338672966902,
          "position_start": null,
          "position_end": null
        }
      ]
    }
  ]
}

Back to top