Skip to main content
POST
/
async-parsing
/
parsers
Create a parser
import requests

url = "https://{FUSION HOST}/async-parsing/parsers"

payload = {
    "id": "my-test-parser",
    "enableMediaTypeDetection": True,
    "detectMediaTypeBasedOnExtension": True,
    "maxParserDepth": 16,
    "maxFieldLength": -1,
    "parserStages": [
        {
            "type": "json",
            "enabled": True,
            "mediaTypes": [],
            "pathPatterns": [],
            "errorHandling": "mark",
            "id": "f08ef428-ed61-42b1-acd1-8f0ae8fb916d",
            "splitArrays": True,
            "includePath": False,
            "mappings": [],
            "listHandling": "multivalued",
            "expectJsonL": False,
            "maxLineSize": 8192,
            "inheritMediaTypes": True,
            "ignoredMediaTypes": [],
            "outputFieldPrefix": ""
        },
        {
            "type": "text",
            "enabled": True,
            "charset": "detect",
            "ignoreBOM": False,
            "maxLength": 1048576,
            "maxLineLength": 1048576,
            "outputField": "body",
            "splitLines": False,
            "skipEmptyLines": False,
            "skipHeaderLines": 0,
            "trimWhitespace": False,
            "commentHandling": "include",
            "comment": "#",
            "commentField": "comment",
            "inheritMediaTypes": True
        },
        {
            "type": "fallback",
            "enabled": True,
            "errorHandling": "mark",
            "metadataOnly": False,
            "maxBytesToKeep": 1048576,
            "inheritMediaTypes": True
        }
    ]
}
headers = {"Content-Type": "application/json"}

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

print(response.text)
{
  "id": "my-test-parser",
  "enableMediaTypeDetection": true,
  "detectMediaTypeBasedOnExtension": true,
  "maxParserDepth": 16,
  "maxFieldLength": -1,
  "parserStages": [
    {
      "type": "json",
      "enabled": true,
      "mediaTypes": [],
      "pathPatterns": [],
      "errorHandling": "mark",
      "id": "f08ef428-ed61-42b1-acd1-8f0ae8fb916d",
      "splitArrays": true,
      "includePath": false,
      "mappings": [],
      "listHandling": "multivalued",
      "expectJsonL": false,
      "maxLineSize": 8192,
      "inheritMediaTypes": true,
      "ignoredMediaTypes": [],
      "outputFieldPrefix": ""
    },
    {
      "type": "text",
      "enabled": true,
      "mediaTypes": [],
      "pathPatterns": [],
      "errorHandling": "mark",
      "id": "b3f1fabb-6730-41f8-adbc-cde05c604a06",
      "charset": "detect",
      "ignoreBOM": false,
      "maxLength": 1048576,
      "maxLineLength": 1048576,
      "outputField": "body",
      "splitLines": false,
      "skipEmptyLines": false,
      "skipHeaderLines": 0,
      "trimWhitespace": false,
      "commentHandling": "include",
      "comment": "#",
      "commentField": "comment",
      "inheritMediaTypes": true,
      "ignoredMediaTypes": [],
      "outputFieldPrefix": ""
    },
    {
      "type": "fallback",
      "enabled": true,
      "mediaTypes": [],
      "pathPatterns": [],
      "errorHandling": "mark",
      "id": "a8c6d6e2-ce79-426a-99d5-532ac9ff043e",
      "metadataOnly": false,
      "maxBytesToKeep": 1048576,
      "inheritMediaTypes": true,
      "ignoredMediaTypes": [],
      "outputFieldPrefix": ""
    }
  ]
}

Query Parameters

context
string

The app to which this parser belongs, formatted as app:SomeApp. Any other comma-separated contexts in the context parameter are allowed but ignored.

Body

application/json
id
string
idField
string
enableMediaTypeDetection
boolean
detectMediaTypeBasedOnExtension
boolean
maxParserDepth
integer<int32>
maxFieldLength
integer<int32>
parserStages
object[]

Response

201 - */*

Created

id
string
idField
string
enableMediaTypeDetection
boolean
detectMediaTypeBasedOnExtension
boolean
maxParserDepth
integer<int32>
maxFieldLength
integer<int32>
parserStages
object[]