Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

For example, bellow is a sample of the connector properties.:

Prismic Connector Properties

Expand
titlePrismic Connector Properties
Code Block
"connector": {
  "type": "prismic",
  "options": {
      "query": [],
      "access_token": "",
      "url": ""
  }
}

The query content must be a list of filters and it should be escaped (copy-paste each [] filter into an escape/unescape online tool)

Review this sample from Boxalino`s public Prismic repository:

Code Block
"connector": {
    "type": "prismic",
    "options": {
      "url": "https://rtux-integration.cdn.prismic.io/api/v2/",
      "access_token": "MC5ZSkU4SnhBQUFDSUFXSXZR.77-9QO-_vWR577-977-9HO-_ve-_ve-_vXPvv73vv71LeO-_vUNi77-9Ii3vv73vv73vv71sC2Xvv71A77-9IA",
      "query": ["[at(document.type, \"blog\")]"]
    }
  }

GraphCMS Connector Properties

Expand
titleGraphCMS Connector Properties
Code Block
"connector": {
  "type": "graphql",
  "options": {
      "fields": "",
      "type": "",
      "token": "",
      "endpoint": "",
      "filters": "",
      "locales": []
  }
}

The fields and filters must be escaped (copy-paste the graphiQL section into an escape/unescape online tool)
Review this sample from Boxalino`s public GraphCMS repository:

Code Block
{
  "connector": {
    "type": "graphql",
    "options": {
      "endpoint": "https://api-eu-central-1.graphcms.com/v2/ckll4a83ni7og01yzfr3k9yc4/master",
      "token": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6ImdjbXMtbWFpbi1wcm9kdWN0aW9uIn0.eyJ2ZXJzaW9uIjozLCJpYXQiOjE2MjI1NjIzMzMsImF1ZCI6WyJodHRwczovL2FwaS1ldS1jZW50cmFsLTEuZ3JhcGhjbXMuY29tL3YyL2NrbGw0YTgzbmk3b2cwMXl6ZnIzazl5YzQvbWFzdGVyIiwiaHR0cHM6Ly9tYW5hZ2VtZW50LW5leHQuZ3JhcGhjbXMuY29tIl0sImlzcyI6Imh0dHBzOi8vbWFuYWdlbWVudC5ncmFwaGNtcy5jb20vIiwic3ViIjoiZjZlMTcyNGYtOTI2NS00OTFjLWEwMzktYzFkNGI2ZDExZDA5IiwianRpIjoiY2twZTdweDVoZGR2bzAxejU1NjNwZjc1cCJ9.MjYP8I7OvwyOkiHiB22LPwOfRzEt_ilvp6jHTVufkQEs6UTxJeuOEDvcojbMAgiEa3lStbc3mOVDezOQhMoLdD-UYoSzGyKmzIBI76vsVv5xbkhKwnLBnmX2ssRHMfOgIuyEpG16SwNiyKuBOZdhC39dapEWwSn2bzWqSi4Y-LvIdsANlHfgdwzVzkJNfNAO-2oOMQC4h-QfBlUVoSEQPYLPmGDOUpcawnHXc60Lyg9rCdxooG9YVzXUeqoi4SIc8feHH4My4s_Eb9mprP6sewezTIb4ldPCVwAlh2xl5BrWYDLLNbhgVMmUVaNZjXSS40egT4xxIWiNPw4axCAKZbgsk78lgHo51t0hz8j6qIfn9G_ZNzMagKQRupx4guuMQXiXg30WjSE09HBv6QjDLQRz9A89eRAKCiGVddKGAvXy_cZrAi2OZ_gtsX993wR-kt6AtNZ7s2U5IZPribvLbiNBMtwh1kRfz_t_bUFLCJs7J332odSDkxL38LqR7oRNStZv6EqAXmelWYqBsUvnwZWI3DYqjysYfjb4JALSTwOa4zfDHDkzlaKOiIZwZkI0GroSed_fmL6cfkpmN63CRY3qNQfwG7cXT0mOuOTJSzRBw1QigfCVnM_M2881eBaBdpdwXw3zF7FlxJL1Y0uMSQ0RZ2l3WC81xH7KqUUlUPw",
      "type": "blogs",
      "fields": "{ title __typename locale createdAt active id metaDescription metaTitle publishedAt seoLink updatedAt content {  html text } headerImage { url id width height fileName} stage background { css hex } brands { id name locale } createdBy { id name } history { createdAt } publishedBy { id name } updatedBy { id name } localizations { id locale } }",
      "locales": [
        "de_CH",
        "fr_CH"
      ],
      "filters": "active: true"
    }
  }
}

The filters are optional.
We recommend to sync fully the existing content type and use the API request to set filters.

For example, in case of localization, if your content (ex: blog) is not active in one of the languages and you set a filter for this - the default language values will be set.

...

Check bellow a sample for various integrations following the designed blog logic in our public repository:

Prismic Mapping Sample (doc_content)

Expand
titlePrismic Mapping Sample
Code Block
"mapping": {
    "title": "data.title",
    "description": "data.content",
    "images": "data.header_image.url",
    "tags": {
      "default":"tags",
      "category":"data.category.tags"
     },
    "parent_content_ids": "data.category.id",
    "status": "data.status",
    "string_attributes": {
      "category_uid": "data.category.uid"
    },
    "localized_string_attributes": [
      "data.meta_title",
      "data.content"
    ],
    "numeric_attributes": [
      "data.position"
    ],
    "localized_numeric_attributes": {
      "product_ids":"data.product_ids[*].id"
    },
    "datetime_attributes": {},
    "localized_datetime_attributes": {},
    "raw" : {
      "localized_string_attributes" : [
         "data.content",
         "data.header_image"
       ]
     }
  }

GraphCMS Mapping Sample (doc_content)

Expand
titleGraphCMS Mapping sample

Warning : the mapping fields must exist in the connector options ~fields~ property.

Code Block
"mapping": {
    "title": "title",
    "description": "content.text",
    "images": "headerImage.url",
    "link": "seoLink",
    "tags": {
      "brands":"brands[*].name"
    },
    "status": "stage",
    "string_attributes": {
      "background_hex": "background.hex",
      "background_css": "background.css",
      "brand_ids" : "brands[*].id",
      "brands" : "brands[*].name"
    },
    "localized_numeric_attributes": {
      "active" : "active"
    },
    "localized_string_attributes": {
      "meta_title": "metaTitle",
      "meta_description": "metaDescription",
      "content":"content.html"
    },
    "raw": {
        "localized_string_attributes": [
          "content",
          "background",
          "brands",
          "headerImage"
        ]
    }
  }

Info

At Boxalino, we try to map the way our client expects for a headless integration to work.

For this reason, if your connector integration libraries allows for content to be accessed as HTML or text (ex: data.content) - this is as well possible.

In the above sample:

  1. data.content is a RichText (editor) input

  2. when using the mapping “description”:data.content - it will be exported as TEXT

  3. when adding the mapping for localized_string_attributes - it will be exported as HTML.

  4. when adding the mapping in raw it will be exported as raw JSON

...