Assign Category Item

This page describes the request data identifiers and response structure required to link an entity (product, post, etc.) to a category.

Data Identifier

{
  "dataID": "ASSIGN_CATEGORY_ITEM",
  "entity_type": "PRODUCT",
  "entity_seq": 340,
  "category_seq": [
    2,
    5
  ]
}
KeyDescription
dataIDData identifier ASSIGN_CATEGORY_ITEM
entity_typeType of the item to link, e.g. PRODUCT
entity_seqNumber of the item (e.g. product seq)
category_seqArray of category numbers. Replaces the whole set of links.

HTML

<form id="frm_assign_category_item">
  <input type="hidden" name="entity_type" value="PRODUCT">
  <input type="hidden" name="entity_seq" value="340">
  <input type="checkbox" name="category_seq[]" value="2" checked=""> T-Shirts
  <input type="checkbox" name="category_seq[]" value="3"> Hoodies
  <input type="checkbox" name="category_seq[]" value="5" checked=""> Drinkware
  <button type="submit" class="btn btn-primary">Apply</button>
</form>

Response Result

{
  "result": true,
  "entity_type": "PRODUCT",
  "entity_seq": 340,
  "category_list": [
    {
      "seq": 2,
      "parent_seq": 1,
      "code": "TSHIRTS",
      "name": "T-Shirts",
      "depth": 1,
      "sort_order": 1,
      "status": "ACTIVE",
      "extra_data": null,
      "created_by": 3,
      "updated_by": 3,
      "create_date": "2026-10-04 11:57:33",
      "modify_date": null,
      "delete_flg": "N",
      "map_sort_order": 0
    },
    {
      "seq": 3,
      "parent_seq": 1,
      "code": "HOODIES",
      "name": "Hoodies",
      "depth": 1,
      "sort_order": 2,
      "status": "ACTIVE",
      "extra_data": null,
      "created_by": 3,
      "updated_by": 3,
      "create_date": "2026-10-04 11:57:33",
      "modify_date": null,
      "delete_flg": "N",
      "map_sort_order": 1
    }
  ]
}
KeyDescription
resultSucceeded or not (true / false)
entity_typeItem type you sent
entity_seqItem number you sent (number)
category_listCategories now linked to the item
category_list[n].map_sort_orderOrder of the link for this item (from 0)
  • category_seq replaces, it does not append. An empty array removes every link, and array order becomes map_sort_order (from 0).
  • For products you can also link categories inside SAVE_PRODUCT with category_sync=1, category_seq[] and category_default. Use this API for other item types or bulk linking.
  • Error codes — errors also come back as HTTP 200. Check result:false, then error_code (string) and error_message.
  • 401 — Sign-in required (Unauthorized).
  • 400 — entity_type and entity_seq are required.

Example

Assign product #340 to categories
T-Shirts Drinkware
<script setup>
import { ref } from 'vue'
// Replace the full set of categories a product belongs to (empty array clears all mappings).
const selected = ref([2, 5])
const assigned = ref([])
async function assign() {
  const { output } = await useNuxtApp().$connector({
    dataID: 'ASSIGN_CATEGORY_ITEM', entity_type: 'PRODUCT', entity_seq: 340, category_seq: selected.value
  })
  assigned.value = output.category_list
}
</script>

<template>
  <div class="card shadow-sm p-4">
    <h5 class="mb-3">Assign product #340 to categories</h5>
    <div class="form-check"><input class="form-check-input" type="checkbox" value="2" v-model="selected"><label class="form-check-label">T-Shirts</label></div>
    <div class="form-check"><input class="form-check-input" type="checkbox" value="3" v-model="selected"><label class="form-check-label">Hoodies</label></div>
    <div class="form-check"><input class="form-check-input" type="checkbox" value="5" v-model="selected"><label class="form-check-label">Drinkware</label></div>
    <button class="btn btn-primary mt-3" @click="assign">Apply</button>
    <div class="mt-3">
      <span class="badge bg-info me-1" v-for="c in assigned" :key="c.seq">{{ c.name }}</span>
    </div>
  </div>
</template>
<?php
$requestData = [
    'dataID'      => 'ASSIGN_CATEGORY_ITEM',
    'entity_type' => 'PRODUCT',       // PRODUCT / POST / WEB_FORM ...
    'entity_seq'  => 340,
    'category_seq'=> [2, 5],           // full desired set; [] clears every mapping
];
$output = $connector->request($requestData);

echo 'Now in: ';
foreach ($output['category_list'] as $c) {
    echo htmlspecialchars($c['name']) . ' ';
}