Inventory & Products | Products | Tags | Get Tags Relations

Getting Product Tags Relations

This document outlines the procedure for making API calls to retrieve tag assignments for a specific product from https://easycms.fi/public_api/get_product_tags_relations/.

Important Note

The pid (Product ID) parameter is MANDATORY for this endpoint. Only a single product ID is allowed per request — arrays are not accepted. Use this endpoint to fetch all tags associated with a specific product.

Product Tags Relations Data Retrieval

Fetch the tags assigned to a specific product. Each tag includes its ID, multilingual name, visibility status, and image.

Endpoint and Method

  • Endpoint: https://easycms.fi/public_api/get_product_tags_relations/
  • Method: GET or POST

Parameters | Payload

  • TOKEN (api_key): Your unique API key for authentication. How to Create API Credentials.
  • username: Your login username.
  • password: Your login password.
  • account: Your specific account ID.

Required Parameter

  • pid: Product ID (MANDATORY) - A single integer. Arrays and JSON lists are not allowed. Must be a valid, non-deleted product ID.

Pagination Parameters

  • start - Specify the starting point of the row from which to begin fetching tag data (default: 0).
  • limit - Control the number of tag records returned in a single request (default: 50, max: 50).



Call Examples in Different Languages


curl -X POST 'https://easycms.fi/public_api/get_product_tags_relations' \
-H 'Authorization1: TOKEN' \
-d 'username=USERNAME&password=PASSWORD&account=ACCOUNT_ID&pid=12345'

$curl = curl_init();
curl_setopt_array($curl, array(
  CURLOPT_URL => "https://easycms.fi/public_api/get_product_tags_relations",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_POST => true,
  CURLOPT_POSTFIELDS => http_build_query([
    'username' => 'USERNAME',
    'password' => 'PASSWORD',
    'account' => 'ACCOUNT_ID',
    'pid' => 12345
  ]),
  CURLOPT_HTTPHEADER => array("Authorization1: TOKEN"),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;

import requests
url = "https://easycms.fi/public_api/get_product_tags_relations"
headers = {"Authorization1": "TOKEN"}
payload = {
    'username': 'USERNAME',
    'password': 'PASSWORD',
    'account': 'ACCOUNT_ID',
    'pid': 12345
}
response = requests.post(url, headers=headers, data=payload)
print(response.text)

HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
    .uri(URI.create("https://easycms.fi/public_api/get_product_tags_relations"))
    .headers("Authorization1", "TOKEN")
    .POST(HttpRequest.BodyPublishers.ofString(
        "username=USERNAME&password=PASSWORD&account=ACCOUNT_ID&pid=12345"))
    .build();
HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());

const https = require('https');
const data = new URLSearchParams({
  username: 'USERNAME',
  password: 'PASSWORD',
  account: 'ACCOUNT_ID',
  pid: 12345
}).toString();
const options = {
  hostname: 'easycms.fi',
  path: '/public_api/get_product_tags_relations',
  method: 'POST',
  headers: {
    'Authorization1': 'TOKEN',
    'Content-Type': 'application/x-www-form-urlencoded',
    'Content-Length': data.length
  }
};
const req = https.request(options, (res) => {
  let data = '';
  res.on('data', (chunk) => { data += chunk; });
  res.on('end', () => { console.log(data); });
});
req.on('error', (e) => { console.error(e); });
req.write(data);
req.end();

import React, { useEffect, useState } from 'react';
function App() {
  const [tagsData, setTagsData] = useState('');
  useEffect(() => {
    const fetchData = async () => {
      try {
        const response = await fetch('https://easycms.fi/public_api/get_product_tags_relations', {
          method: 'POST',
          headers: {'Authorization1': 'TOKEN', 'Content-Type': 'application/x-www-form-urlencoded'},
          body: new URLSearchParams({
            username: 'USERNAME',
            password: 'PASSWORD',
            account: 'ACCOUNT_ID',
            pid: 12345
          }).toString()
        });
        const data = await response.text();
        setTagsData(data);
      } catch (error) {
        console.error(error);
      }
    };
    fetchData();
  }, []);
  return (<div>{tagsData}</div>);
}
export default App;

import okhttp3.OkHttpClient
import okhttp3.FormBody
import okhttp3.Request

fun main() {
    val client = OkHttpClient()

    val formBody = FormBody.Builder()
        .add("username", "USERNAME")
        .add("password", "PASSWORD")
        .add("account", "ACCOUNT_ID")
        .add("pid", "12345")
        .build()

    val request = Request.Builder()
        .url("https://easycms.fi/public_api/get_product_tags_relations")
        .post(formBody)
        .addHeader("Authorization1", "TOKEN")
        .build()

    client.newCall(request).execute().use { response ->
        if (!response.isSuccessful) throw IOException("Unexpected code $response")
        println(response.body?.string())
    }
}

using System;
using System.Net.Http;
using System.Threading.Tasks;
class Program
{
    static async Task Main()
    {
        var token = "TOKEN";
        var content = new FormUrlEncodedContent(new[]
        {
            new KeyValuePair<string, string>("username", "USERNAME"),
            new KeyValuePair<string, string>("password", "PASSWORD"),
            new KeyValuePair<string, string>("account", "ACCOUNT_ID"),
            new KeyValuePair<string, string>("pid", "12345")
        });
        using (var httpClient = new HttpClient())
        {
            httpClient.DefaultRequestHeaders.Add("Authorization1", token);
            var response = await httpClient.PostAsync("https://easycms.fi/public_api/get_product_tags_relations", content);
            if (response.IsSuccessStatusCode)
            {
                var responseData = await response.Content.ReadAsStringAsync();
                Console.WriteLine(responseData);
            }
            else
            {
                Console.WriteLine($"Error: {response.StatusCode}");
            }
        }
    }
}




Handling Endpoint Results

When you make a request to the endpoint, you receive a JSON response containing various keys and values. Here's an explanation of the response keys and their meanings:


- `start`: The starting index for pagination. Default is 0.

- `limit`: The maximum number of tag records returned. Default is 50, maximum is 50.

- `pid`: The product ID that was queried.

- `count`: The number of tag records returned in this response.

- `total_count`: The total number of tags assigned to this product.

- `docs`: URL to this documentation page.
    

- `id`: The internal ID of the tag relation record.
- `pid`: The product ID this tag is assigned to.
- `products_tags_id`: The unique identifier for the tag.
- `products_tags_name`: An object containing tag names in different languages.
  - `fi_FI`: Tag name in Finnish.
  - `en_GB`: Tag name in English.
  - `sv_SE`: Tag name in Swedish.
  - Additional languages may be present depending on configuration.
- `visible`: Visibility status of the tag (1 = visible, 0 = hidden).
- `image_name`: The filename of the image associated with the tag.

These key-value pairs provide the tag assignments for a specific product and can be used for filtering, categorization, and display in your application.
    

{
  "INFO": {
    "start": 0,
    "limit": 50,
    "pid": 12345,
    "count": 2,
    "total_count": 2,
    "docs": "https://cms.helpostikotisivut.fi/DOCUMENTATION/bt5/get_product_tags_relations"
  },
  "OUTPUT": [
    {
      "id": "15",
      "pid": "12345",
      "products_tags_id": "1",
      "products_tags_name": {
        "fi_FI": "Uutuus",
        "en_GB": "New",
        "sv_SE": "Nyhet"
      },
      "visible": "1",
      "image_name": "new-icon.png"
    },
    {
      "id": "22",
      "pid": "12345",
      "products_tags_id": "3",
      "products_tags_name": {
        "fi_FI": "Alennus",
        "en_GB": "Discount",
        "sv_SE": "Rabatt"
      },
      "visible": "1",
      "image_name": "discount-icon.png"
    }
  ]
}
      

Error Handling

Here are the possible error messages and their meanings:

Error Code HTTP Status Description
pid_parameter_is_required 400 The pid parameter is required
pid_must_be_a_single_integer_arrays_are_not_allowed 400 Only a single integer pid is accepted, arrays are not allowed
pid_must_be_a_valid_positive_integer 400 The pid must be a valid positive integer greater than 0
product_not_found 404 The product with the specified pid does not exist or has been deleted
UN-AUTHORIZED 401 Incorrect username or password
this_account_does_not_exist_or_your_credentials_do_not_match_this_account 401 The account doesn't exist or mismatched credentials
Maximum query size is 50 rows per query 400 Exceeded maximum limit of 50 rows per query

Error Response Example

{
  "INFO": {
    "start": 0,
    "limit": 50,
    "pid": 999999
  },
  "OUTPUT": {
    "response_type": "error",
    "message": "product_not_found"
  }
}

Empty Tags Response

When a product exists but has no tags assigned:

{
  "INFO": {
    "start": 0,
    "limit": 50,
    "pid": 12345,
    "count": 0,
    "total_count": 0
  },
  "OUTPUT": []
}

Use Cases

Fetch Tags for a Single Product

POST /get_product_tags_relations?pid=12345

Combine with Product Data

Use this endpoint together with get_products to build a complete product view:

const [product, tags] = await Promise.all([
  getProducts({ pid: 12345 }),
  getProductTagsRelations({ pid: 12345 })
]);
console.log(`Product: ${product.OUTPUT[0].product_name.en_GB}`);
console.log(`Tags: ${tags.OUTPUT.map(t => t.products_tags_name.en_GB).join(', ')}`);

Combine with Stock Data

For a complete product profile, fetch products, stock, and tags in parallel:

const [product, stock, incomingStock, tags] = await Promise.all([
  getProducts({ pid: 12345, include_stock: 1 }),
  getProductsStock({ pid: 12345 }),
  getProductsIncomingStock({ pid: 12345 }),
  getProductTagsRelations({ pid: 12345 })
]);

Related Endpoints