NLG APIs

Document Plans

List Document Plans

Request:

# HTTP:
GET:            /document-plans

Response:

# Headers:
Content-Type:   application/json
# Body:
items:
    -
        id:     uuid-0001
        name:   Document Plan One
    -
        id:     uuid-0002
        name:   Document Plan Two

Create a Document Plan

Request:

# HTTP:
POST:           /document-plans
# Body:
name:           Document Plan One
blocklyXml:     "..."
gremlinCode:    "..."

Response:

# Headers:
Content-Type:   application/json
# Body:
id:             uuid-0001
name:           Document Plan One
blocklyXml:     "..."
gremlinCode:    "..."

Update a Document Plan

Request:

# HTTP:
PUT:            /document-plans/uuid-0002
# Body:
id:             uuid-0002
name:           Document Plan Two
blocklyXml:     "..."
gremlinCode:    "..."

Response:

# Headers:
Content-Type:   application/json
# Body:
id:             uuid-0002
name:           Document Plan Two
blocklyXml:     "..."
gremlinCode:    "..."

Get a Document Plan

Request

# HTTP:
GET:            /document-plans/uuid-0003

Response

# Headers:
Content-Type:   application/json
# Body:
id:             uuid-0003
name:           Document Plan Three
blocklyXml:     "..."
gremlinCode:    "..."

Delete a Document Plan

Request

# HTTP:
DELETE:         /document-plans/uuid-0004

Response

# HTTP:
Status:         200
# Headers:
Content-Type:   application/json
# Body:
"ok"

Data Samples

List Data Samples

Request

# HTTP:
GET:            /data-samples

Response:

# Headers:
Content-Type:   application/json
# Body:
items:
    -
        id:         uuid-0001
        filename:   t-shirts.csv
    -
        id:         uuid-0002
        filename:   hotels.csv

Create a Data Sample

Request

# HTTP:
POST:           /data-samples
# Headers:
Content-Type: multipart/form-data; boundary=----RandomString1234567890
# Body:
------RandomString1234567890
Content-Disposition: form-data; name="data_sample"; filename="t-shirts.csv"
Content-Type: text/csv

"color","material"
"red","cotton"
"blue","wool"
------RandomString1234567890--

Response

# HTTP:
Status:         200
# Headers:
Content-Type:   text/csv
# Body:
"color","material"
"red","cotton"
"blue","wool"

Update a Data Sample

Request

# HTTP:
PUT:            /data-samples/uuid-0000
# Headers:
Content-Type: multipart/form-data; boundary=----RandomString1234567890
# Body:
------RandomString1234567890
Content-Disposition: form-data; name="data_sample"; filename="t-shirts2.csv"
Content-Type: text/csv

"color","material"
"red","cotton"
"blue","wool"
------RandomString1234567890--

Response

# HTTP:
Status:         200
# Headers:
Content-Type:   text/csv
# Body:
"color","material"
"red","cotton"
"blue","wool"

Get a Data Sample

Request

# HTTP:
GET:            /data-samples/uuid-0000

Response

# Headers:
Content-Type:   text/csv
# Body:
"color","material"
"red","cotton"
"blue","wool"

Delete a Data Sample

Request

# HTTP:
DELETE:         /data-samples/uuid-0000

Response

# HTTP:
Status:         200
# Headers:
Content-Type:   application/json
# Body:
"ok"

Text Variants

Create Variants from a Data Sample

Request

# HTTP:
POST:           /text-variants/from-data-sample
# Headers:
Accept:         application/json
Content-Type:   application/json
# Body:
documentPlanId: uuid-0001
dataSampleId:   uuid-0002

Response

# Headers:
Content-Type:   application/json
# Body:
offset:         0
totalCount:     1234567
variants:       [ ...Annotated Text Elements... ]

See full JSON example.

See Annotated Text JSON (ATJ) docs for more details.

Create Variants from a Record

Request

# HTTP:
POST:           /text-variants/from-record
# Headers:
Accept:         application/json
Content-Type:   application/json
# Body:
documentPlanId: uuid-0001
record:
    attr1:      value1
    attrTwo:    another_value

Response

# Headers:
Content-Type:   application/json
# Body:
offset:         0
totalCount:     1234567
variants:       [ ...Annotated Text Elements... ]

See full JSON example.

See Annotated Text JSON (ATJ) docs for more details.