Artica Wiki

Manage categories with REST API

Artica exposes a comprehensive REST API for managing personal web‐filtering categories programmatically

Artica exposes a comprehensive REST API for managing personal web‐filtering categories programmatically

This feature is available on Artica v4.50 Service Pack 5 or Artica v4.50 Service Pack 4 Hotfix 20250605-13

Query a category for a designed website

The following url GET http://1.2.3.4:9503/categories/query/domain.tld allow to check a category against a designed website.
It return a json with all categories found.
If the domain is not categorized the Status attribute of the json is false

command-line:  artica-phpfpm-service -rest-api /categories/query/3dvsem.com

Result example:

{
  "Status": true,  
"Info": "063tutu.com found inside 1 categorie(s)",
  "Error": "",
  "Categories": [
      {
          "table_name": "category_chineseads",
          "category_name": "chineseads",
          "category_id": 258,
          "rpz_enabled": 0,
          "rpz_action": 2,
          "rpz_redirect": ""
      }
  ]
}

List available categories

The following url return a json of all available categories.
the attribute categories return an array with the ID of the category ( id number ) associated to the NAME and DESCRIPTION

GET http://1.2.3.4:9503/categories/list
command-line:  artica-phpfpm-service -rest-api /categories/list

{
  "Status": true,
  "Error": "",
  "Categories": [
      {
          "table_name": "",
          "category_name": "github1",
          "category_id": 252,
          "rpz_enabled": 0,
          "rpz_action": 2,
          "rpz_redirect": ""
      }
}

Create a new category

The following url PUT http://1.2.3.4:9503/categories/create Create a category with the following fields:

Example 
command-line:  artica-phpfpm-service -rest-api-put /categories/create -value "name=whitelist_vip&description=For vips"
curl -X PUT http://1.2.3.4:9503/categories/create -d "name=whitelist_vip" -d "description=For vips"

Add website inside a category

The following url GET http://1.2.3.4:9000/categories/[ID]/[sitename] add the Website [sitename] inside the category id [ID].

command-line:  artica-phpfpm-service -rest-api /categories/252/skiokz.com

Add a new website in emergency mode.

When you add sites to your personal categories, you need to compile those categories and apply the filtering rules. 
Your new site will then be incorporated and active in the rules within a few minutes. 

This batch operation is designed to speed up the process by performing all steps at once.

To add websites to a category, you first need to know its identifier. 
You can retrieve this by calling the API that lists your personal categories—each category’s ID is provided in the category_id field. 
Once you have that ID, use the category-enrichment API to add your site.

GET http://1.2.3.4:9503/categories/list
command-line:  artica-phpfpm-service -rest-api /categories/list

{
  "Status": true,
  "Error": "",
  "Categories": [
      {
          "table_name": "",
          "category_name": "github1",
          "category_id": 252,
          "rpz_enabled": 0,
          "rpz_action": 2,
          "rpz_redirect": ""
      }
}

PUT http://1.2.3.4:9503/categories/quick/[ID]

use items as name field

command-line:= artica-phpfpm-service -rest-api-put /categories/quick/252 -value items=esperanza.pl,svekrovi.net,gospmr.org,3dvsem.com,skiokz.com,tomlankhorst.nl

curl example: 

curl -X PUT http://1.2.3.4:9503/categories/quick/252  -d "items==esperanza.pl,svekrovi.net,gospmr.org,3dvsem.com,skiokz.com,tomlankhorst.nl"

Move a website from a category to other category

The following url GET http://1.2.3.4:9503/categories/move/[ID]/[sitename]/[NEXTID] remove the website [sitename] from category id [ID] and force to add it into the category id [NEXTID].

command-line:= artica-phpfpm-service -rest-api categories/move/252/skiokz.com/258
 

Remove a website from a category

The following url GET http://1.2.3.4:9503/categories/delete/[id]/[sitename] Remove the website [sitename] from category id [ID].

command-line:= artica-phpfpm-service -rest-api categories/delete/252/skiokz.com

Backup your categories

GET http://[server]:[port]/categories/backup

Will export all categories data to the /home/artica/backup-categories folder