> This page is for API Reference.

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://fiftytwo-demo.ferndocs.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://fiftytwo-demo.ferndocs.com/_mcp/server.

# Insert/Update a list of view groups on the EC.

POST https://api.fiftytwo.com/masterdata/viewgroups/v1/chain/{chain}
Content-Type: application/json

Only supported when Masterdata is distributed by the EC.

Reference: https://fiftytwo-demo.ferndocs.com/api/master-data/reference/view-groups/ecstg

## Request

### Path parameters

- `chain` (integer, required) — The ID of the Chain

### Body (application/json)

This endpoint expects a viewGroups.

- `viewGroups` (list of ViewGroupsViewGroupsItems, required)

## Response

### 202

Accepted

## Errors

### 400 Bad Request Error

Bad Request

- `string`

## Types

### ViewGroupsViewGroupsItems

- `viewGroupId` (integer, required) — Unique numeric identifier for the view group. (VA09).
- `name` (string, required) — The display name of the view group shown in the user interface.
- `description` (string, optional) — Short optional description of the view group.
- `imageId` (string, optional) — Identifier of the image linked to this view group. Must be a 32-character lowercase MD5 hash. For more information, see the image section.
- `details` (ViewGroupsViewGroupsItemsDetails, optional) — Defines which items belong to this view group, grouped by item type. Can include articles or nested view groups.

### ViewGroupsViewGroupsItemsDetails

Defines which items belong to this view group, grouped by item type. Can include articles or nested view groups.

- `articles` (list of integer, optional) — List of article IDs that are part of the view group.
- `viewGroups` (list of integer, optional) — List of nested view group IDs that are part of the view group.

## Examples

**Request**

```json
{
  "viewGroups": [
    {
      "viewGroupId": 1001,
      "name": "Fresh Food",
      "description": "Store front",
      "imageId": "aabbccddeeff00112233445566778899",
      "details": {
        "articles": [
          20001,
          20002
        ],
        "viewGroups": [
          1101,
          1102
        ]
      }
    },
    {
      "viewGroupId": 1101,
      "name": "Fruits",
      "description": "Seasonal mix",
      "imageId": "112233445566778899aabbccddeeff00",
      "details": {
        "articles": [
          30001,
          30002,
          30003
        ],
        "viewGroups": []
      }
    },
    {
      "viewGroupId": 1102,
      "name": "Vegetables",
      "description": "Daily greens",
      "imageId": "ffeeddccbbaa99887766554433221100",
      "details": {
        "articles": [
          31001,
          31002
        ],
        "viewGroups": []
      }
    },
    {
      "viewGroupId": 1200,
      "name": "Weekly Deals",
      "description": "Promo picks",
      "imageId": "00112233445566778899aabbccddeeff",
      "details": {
        "articles": [
          40001
        ],
        "viewGroups": [
          1001
        ]
      }
    }
  ]
}
```

**Response**

```json
{}
```

**SDK Code**

```python ViewGroups_ECSTG_example
import requests

url = "https://api.fiftytwo.com/masterdata/viewgroups/v1/chain/1"

payload = { "viewGroups": [
        {
            "viewGroupId": 1001,
            "name": "Fresh Food",
            "description": "Store front",
            "imageId": "aabbccddeeff00112233445566778899",
            "details": {
                "articles": [20001, 20002],
                "viewGroups": [1101, 1102]
            }
        },
        {
            "viewGroupId": 1101,
            "name": "Fruits",
            "description": "Seasonal mix",
            "imageId": "112233445566778899aabbccddeeff00",
            "details": {
                "articles": [30001, 30002, 30003],
                "viewGroups": []
            }
        },
        {
            "viewGroupId": 1102,
            "name": "Vegetables",
            "description": "Daily greens",
            "imageId": "ffeeddccbbaa99887766554433221100",
            "details": {
                "articles": [31001, 31002],
                "viewGroups": []
            }
        },
        {
            "viewGroupId": 1200,
            "name": "Weekly Deals",
            "description": "Promo picks",
            "imageId": "00112233445566778899aabbccddeeff",
            "details": {
                "articles": [40001],
                "viewGroups": [1001]
            }
        }
    ] }
headers = {"Content-Type": "application/json"}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript ViewGroups_ECSTG_example
const url = 'https://api.fiftytwo.com/masterdata/viewgroups/v1/chain/1';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: '{"viewGroups":[{"viewGroupId":1001,"name":"Fresh Food","description":"Store front","imageId":"aabbccddeeff00112233445566778899","details":{"articles":[20001,20002],"viewGroups":[1101,1102]}},{"viewGroupId":1101,"name":"Fruits","description":"Seasonal mix","imageId":"112233445566778899aabbccddeeff00","details":{"articles":[30001,30002,30003],"viewGroups":[]}},{"viewGroupId":1102,"name":"Vegetables","description":"Daily greens","imageId":"ffeeddccbbaa99887766554433221100","details":{"articles":[31001,31002],"viewGroups":[]}},{"viewGroupId":1200,"name":"Weekly Deals","description":"Promo picks","imageId":"00112233445566778899aabbccddeeff","details":{"articles":[40001],"viewGroups":[1001]}}]}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go ViewGroups_ECSTG_example
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.fiftytwo.com/masterdata/viewgroups/v1/chain/1"

	payload := strings.NewReader("{\n  \"viewGroups\": [\n    {\n      \"viewGroupId\": 1001,\n      \"name\": \"Fresh Food\",\n      \"description\": \"Store front\",\n      \"imageId\": \"aabbccddeeff00112233445566778899\",\n      \"details\": {\n        \"articles\": [\n          20001,\n          20002\n        ],\n        \"viewGroups\": [\n          1101,\n          1102\n        ]\n      }\n    },\n    {\n      \"viewGroupId\": 1101,\n      \"name\": \"Fruits\",\n      \"description\": \"Seasonal mix\",\n      \"imageId\": \"112233445566778899aabbccddeeff00\",\n      \"details\": {\n        \"articles\": [\n          30001,\n          30002,\n          30003\n        ],\n        \"viewGroups\": []\n      }\n    },\n    {\n      \"viewGroupId\": 1102,\n      \"name\": \"Vegetables\",\n      \"description\": \"Daily greens\",\n      \"imageId\": \"ffeeddccbbaa99887766554433221100\",\n      \"details\": {\n        \"articles\": [\n          31001,\n          31002\n        ],\n        \"viewGroups\": []\n      }\n    },\n    {\n      \"viewGroupId\": 1200,\n      \"name\": \"Weekly Deals\",\n      \"description\": \"Promo picks\",\n      \"imageId\": \"00112233445566778899aabbccddeeff\",\n      \"details\": {\n        \"articles\": [\n          40001\n        ],\n        \"viewGroups\": [\n          1001\n        ]\n      }\n    }\n  ]\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby ViewGroups_ECSTG_example
require 'uri'
require 'net/http'

url = URI("https://api.fiftytwo.com/masterdata/viewgroups/v1/chain/1")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n  \"viewGroups\": [\n    {\n      \"viewGroupId\": 1001,\n      \"name\": \"Fresh Food\",\n      \"description\": \"Store front\",\n      \"imageId\": \"aabbccddeeff00112233445566778899\",\n      \"details\": {\n        \"articles\": [\n          20001,\n          20002\n        ],\n        \"viewGroups\": [\n          1101,\n          1102\n        ]\n      }\n    },\n    {\n      \"viewGroupId\": 1101,\n      \"name\": \"Fruits\",\n      \"description\": \"Seasonal mix\",\n      \"imageId\": \"112233445566778899aabbccddeeff00\",\n      \"details\": {\n        \"articles\": [\n          30001,\n          30002,\n          30003\n        ],\n        \"viewGroups\": []\n      }\n    },\n    {\n      \"viewGroupId\": 1102,\n      \"name\": \"Vegetables\",\n      \"description\": \"Daily greens\",\n      \"imageId\": \"ffeeddccbbaa99887766554433221100\",\n      \"details\": {\n        \"articles\": [\n          31001,\n          31002\n        ],\n        \"viewGroups\": []\n      }\n    },\n    {\n      \"viewGroupId\": 1200,\n      \"name\": \"Weekly Deals\",\n      \"description\": \"Promo picks\",\n      \"imageId\": \"00112233445566778899aabbccddeeff\",\n      \"details\": {\n        \"articles\": [\n          40001\n        ],\n        \"viewGroups\": [\n          1001\n        ]\n      }\n    }\n  ]\n}"

response = http.request(request)
puts response.read_body
```

```java ViewGroups_ECSTG_example
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.fiftytwo.com/masterdata/viewgroups/v1/chain/1")
  .header("Content-Type", "application/json")
  .body("{\n  \"viewGroups\": [\n    {\n      \"viewGroupId\": 1001,\n      \"name\": \"Fresh Food\",\n      \"description\": \"Store front\",\n      \"imageId\": \"aabbccddeeff00112233445566778899\",\n      \"details\": {\n        \"articles\": [\n          20001,\n          20002\n        ],\n        \"viewGroups\": [\n          1101,\n          1102\n        ]\n      }\n    },\n    {\n      \"viewGroupId\": 1101,\n      \"name\": \"Fruits\",\n      \"description\": \"Seasonal mix\",\n      \"imageId\": \"112233445566778899aabbccddeeff00\",\n      \"details\": {\n        \"articles\": [\n          30001,\n          30002,\n          30003\n        ],\n        \"viewGroups\": []\n      }\n    },\n    {\n      \"viewGroupId\": 1102,\n      \"name\": \"Vegetables\",\n      \"description\": \"Daily greens\",\n      \"imageId\": \"ffeeddccbbaa99887766554433221100\",\n      \"details\": {\n        \"articles\": [\n          31001,\n          31002\n        ],\n        \"viewGroups\": []\n      }\n    },\n    {\n      \"viewGroupId\": 1200,\n      \"name\": \"Weekly Deals\",\n      \"description\": \"Promo picks\",\n      \"imageId\": \"00112233445566778899aabbccddeeff\",\n      \"details\": {\n        \"articles\": [\n          40001\n        ],\n        \"viewGroups\": [\n          1001\n        ]\n      }\n    }\n  ]\n}")
  .asString();
```

```php ViewGroups_ECSTG_example
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.fiftytwo.com/masterdata/viewgroups/v1/chain/1', [
  'body' => '{
  "viewGroups": [
    {
      "viewGroupId": 1001,
      "name": "Fresh Food",
      "description": "Store front",
      "imageId": "aabbccddeeff00112233445566778899",
      "details": {
        "articles": [
          20001,
          20002
        ],
        "viewGroups": [
          1101,
          1102
        ]
      }
    },
    {
      "viewGroupId": 1101,
      "name": "Fruits",
      "description": "Seasonal mix",
      "imageId": "112233445566778899aabbccddeeff00",
      "details": {
        "articles": [
          30001,
          30002,
          30003
        ],
        "viewGroups": []
      }
    },
    {
      "viewGroupId": 1102,
      "name": "Vegetables",
      "description": "Daily greens",
      "imageId": "ffeeddccbbaa99887766554433221100",
      "details": {
        "articles": [
          31001,
          31002
        ],
        "viewGroups": []
      }
    },
    {
      "viewGroupId": 1200,
      "name": "Weekly Deals",
      "description": "Promo picks",
      "imageId": "00112233445566778899aabbccddeeff",
      "details": {
        "articles": [
          40001
        ],
        "viewGroups": [
          1001
        ]
      }
    }
  ]
}',
  'headers' => [
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp ViewGroups_ECSTG_example
using RestSharp;

var client = new RestClient("https://api.fiftytwo.com/masterdata/viewgroups/v1/chain/1");
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"viewGroups\": [\n    {\n      \"viewGroupId\": 1001,\n      \"name\": \"Fresh Food\",\n      \"description\": \"Store front\",\n      \"imageId\": \"aabbccddeeff00112233445566778899\",\n      \"details\": {\n        \"articles\": [\n          20001,\n          20002\n        ],\n        \"viewGroups\": [\n          1101,\n          1102\n        ]\n      }\n    },\n    {\n      \"viewGroupId\": 1101,\n      \"name\": \"Fruits\",\n      \"description\": \"Seasonal mix\",\n      \"imageId\": \"112233445566778899aabbccddeeff00\",\n      \"details\": {\n        \"articles\": [\n          30001,\n          30002,\n          30003\n        ],\n        \"viewGroups\": []\n      }\n    },\n    {\n      \"viewGroupId\": 1102,\n      \"name\": \"Vegetables\",\n      \"description\": \"Daily greens\",\n      \"imageId\": \"ffeeddccbbaa99887766554433221100\",\n      \"details\": {\n        \"articles\": [\n          31001,\n          31002\n        ],\n        \"viewGroups\": []\n      }\n    },\n    {\n      \"viewGroupId\": 1200,\n      \"name\": \"Weekly Deals\",\n      \"description\": \"Promo picks\",\n      \"imageId\": \"00112233445566778899aabbccddeeff\",\n      \"details\": {\n        \"articles\": [\n          40001\n        ],\n        \"viewGroups\": [\n          1001\n        ]\n      }\n    }\n  ]\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift ViewGroups_ECSTG_example
import Foundation

let headers = ["Content-Type": "application/json"]
let parameters = ["viewGroups": [
    [
      "viewGroupId": 1001,
      "name": "Fresh Food",
      "description": "Store front",
      "imageId": "aabbccddeeff00112233445566778899",
      "details": [
        "articles": [20001, 20002],
        "viewGroups": [1101, 1102]
      ]
    ],
    [
      "viewGroupId": 1101,
      "name": "Fruits",
      "description": "Seasonal mix",
      "imageId": "112233445566778899aabbccddeeff00",
      "details": [
        "articles": [30001, 30002, 30003],
        "viewGroups": []
      ]
    ],
    [
      "viewGroupId": 1102,
      "name": "Vegetables",
      "description": "Daily greens",
      "imageId": "ffeeddccbbaa99887766554433221100",
      "details": [
        "articles": [31001, 31002],
        "viewGroups": []
      ]
    ],
    [
      "viewGroupId": 1200,
      "name": "Weekly Deals",
      "description": "Promo picks",
      "imageId": "00112233445566778899aabbccddeeff",
      "details": [
        "articles": [40001],
        "viewGroups": [1001]
      ]
    ]
  ]] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.fiftytwo.com/masterdata/viewgroups/v1/chain/1")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```