0

Do we have a provision to use the external REST API to get data and put into allowed values for a list?

  • Can you elaborate? Do you mean whether mesh is able to PULL data from an external service? – Jotschi Mar 13 '19 at 08:56
  • yes, i want to pull data from external service and from json array received, i want to take the values of a particulat property (e.g. some ID) and put them in the list. I am completely new to mesh and exploring the features right now – Sandeep Mar 14 '19 at 04:37

1 Answers1

1

Data can be added to Gentics Mesh only via the REST API. You would thus need to first define your schema for your contents.

Example:

{
    "name": "test",
    "displayField": "name",
    "segmentField": "",
    "urlFields": [],
    "container": false,
    "fields": [
        {
            "name": "name",
            "label": "Name",
            "required": false,
            "type": "string"
        },
        {
            "name": "ids",
            "label": "IDs",
            "required": false,
            "listType": "number",
            "type": "list"
        }
    ]
}

Next you need to create a project and assign this schema to your project. This needs to be done only once and can be done via the UI.

Now you can use the REST API and store your contents in Gentics Mesh.

The POST request needs to contain the language, parentNode and fields.

POST /api/v1/demo/nodes

{
    "parentNode": {
        "uuid": "960d4632505a445d8d4632505a045d58"
    },
    "language": "en",
    "schema": {
        "name": "test"
    },
    "fields": {
        "name": "MyEntry",
        "ids": [
            1,
            2,
            3
        ]
    }
}

This is how data is being added to Gentics Mesh. If you have a source that needs to be pulled regularly I suggest to write a dedicated importer which fetches the data from the source and adds the data via REST in the format that Gentics Mesh understands.

I hope this answers your question.

Jotschi
  • 3,270
  • 3
  • 31
  • 52