MadKudu Docs

Home

Topical Scorer API with Postman

How to score topics using Postman

Overview

Before getting started, here’s the quick overview of what we are going to be doing:

  • Create a Postman request that:
    • takes a JSON configuration for the domain and topics you want
    • sends it to MadKudu for scoring
    • returns the domain’s scores

Getting Postman

Postman is a powerful visual platform for sending and receiving data to/from a server.

You can use Postman to send a topic configuration to MadKudu, which will respond with the scores for each domain.

Visit getpostman.com to download the free app for your platform. Postman supports MacOS, Windows, and Linux.

Step 1: Configure Postman Request

Once Postman is installed and opened, you’ll need to configure it to make an authenticated POST request to MadKudu.

a. Change your request type to POST (this may start off as GET)
b. Set the request URL to https://api.madkudu.com/v1/companies/prediction
c. Change the Authorization Type to Basic Auth
d. Insert your API Key as the Username.

Step 2: Add Request Body

Now that the request is configured, you’ll need to add data to send to the server.

a. Click the Body tab under the URL bar
b. Change the body type to raw
c. Paste your configuration in the code box

Example configuration

{
    "domain": "patagonia.com.au",
    "model": {
        "parameters": {
            "topics": [{
                "topic": "has_store",
                "keywords": [{
                    "phrase": "store",
                    "weight": 0.25
                }, {
                    "phrase": "locate",
                    "weight": 1
                }, {
                    "phrase": "branch",
                    "weight": 1
                }, {
                    "phrase": "branches",
                    "weight": 1
                }, {
                    "phrase": "stores",
                    "weight": 1
                }, {
                    "phrase": "locator",
                    "weight": 1
                }, {
                    "phrase": "dealership",
                    "weight": 1
                }, {
                    "phrase": "dealer",
                    "weight": 1
                }, {
                    "phrase": "showroom",
                    "weight": 1
                }, {
                    "phrase": "showrooms",
                    "weight": 1
                }, {
                    "phrase": "our store",
                    "weight": 1
                }, {
                    "phrase": "our stores",
                    "weight": 1
                }, {
                    "phrase": "search our store",
                    "weight": -1
                }]
            }, {
                "topic": "has_stockist",
                "keywords": [{
                    "phrase": "stockist",
                    "weight": 1
                }, {
                    "phrase": "stockists",
                    "weight": 1
                }, {
                    "phrase": "distributor",
                    "weight": 0.5
                }]
            }],
            "mode": "contains_exact"
        }
    }
}

Step 3: View the response

Wait for MadKudu to respond to your request, then you will be able to view your data in the resulting JSON.

Example response

{
    "domain": "patagonia.com.au",
    "model": {
        "parameters": {
            "topics": [
                {
                    "topic": "has_store",
                    "keywords": [
                        {
                            "phrase": "store",
                            "weight": 0.25
                        },
                        {
                            "phrase": "locate",
                            "weight": 1
                        },
                        {
                            "phrase": "branch",
                            "weight": 1
                        },
                        {
                            "phrase": "branches",
                            "weight": 1
                        },
                        {
                            "phrase": "stores",
                            "weight": 1
                        },
                        {
                            "phrase": "locator",
                            "weight": 1
                        },
                        {
                            "phrase": "dealership",
                            "weight": 1
                        },
                        {
                            "phrase": "dealer",
                            "weight": 1
                        },
                        {
                            "phrase": "showroom",
                            "weight": 1
                        },
                        {
                            "phrase": "showrooms",
                            "weight": 1
                        },
                        {
                            "phrase": "our store",
                            "weight": 1
                        },
                        {
                            "phrase": "our stores",
                            "weight": 1
                        },
                        {
                            "phrase": "search our store",
                            "weight": -1
                        }
                    ]
                },
                {
                    "topic": "has_stockist",
                    "keywords": [
                        {
                            "phrase": "stockist",
                            "weight": 1
                        },
                        {
                            "phrase": "stockists",
                            "weight": 1
                        },
                        {
                            "phrase": "distributor",
                            "weight": 0.5
                        }
                    ]
                }
            ],
            "mode": "contains_exact"
        }
    },
    "prediction": {
        "main_topic": {
            "name": "has_store",
            "score": 1
        },
        "topics": [
            {
                "name": "has_store",
                "hits": [
                    {
                        "phrase": "store",
                        "hits": 1,
                        "weighted_score": 0.25
                    },
                    {
                        "phrase": "locate",
                        "hits": 0,
                        "weighted_score": 0
                    },
                    {
                        "phrase": "branch",
                        "hits": 0,
                        "weighted_score": 0
                    },
                    {
                        "phrase": "branches",
                        "hits": 0,
                        "weighted_score": 0
                    },
                    {
                        "phrase": "stores",
                        "hits": 4,
                        "weighted_score": 4
                    },
                    {
                        "phrase": "locator",
                        "hits": 0,
                        "weighted_score": 0
                    },
                    {
                        "phrase": "dealership",
                        "hits": 0,
                        "weighted_score": 0
                    },
                    {
                        "phrase": "dealer",
                        "hits": 0,
                        "weighted_score": 0
                    },
                    {
                        "phrase": "showroom",
                        "hits": 0,
                        "weighted_score": 0
                    },
                    {
                        "phrase": "showrooms",
                        "hits": 0,
                        "weighted_score": 0
                    },
                    {
                        "phrase": "our store",
                        "hits": 4,
                        "weighted_score": 4
                    },
                    {
                        "phrase": "our stores",
                        "hits": 4,
                        "weighted_score": 4
                    },
                    {
                        "phrase": "search our store",
                        "hits": 0,
                        "weighted_score": 0
                    }
                ],
                "score": 12.25
            },
            {
                "name": "has_stockist",
                "hits": [
                    {
                        "phrase": "stockist",
                        "hits": 0,
                        "weighted_score": 0
                    },
                    {
                        "phrase": "stockists",
                        "hits": 0,
                        "weighted_score": 0
                    },
                    {
                        "phrase": "distributor",
                        "hits": 0,
                        "weighted_score": 0
                    }
                ],
                "score": 0
            }
        ]
    }
}