Template UI backend APIs
The openapi3 spec can found in the terraform module in spec.tmpl.json.
If you have postman installed you can import the spec file and make request via postman.
Setup an authenticated AWS terminal and run
./scripts/sandbox_auth.sh <email> <password>Grab the AccessToken and api_base_url from sandbox_cognito_auth_token.json
SANDBOX_TOKEN=$(jq -r .AccessToken sandbox_cognito_auth_token.json) && APIG_STAGE=$(jq -r .api_base_url.value ./sandbox_tf_outputs.json)Get a single template by id
curl --location "${APIG_STAGE}/v1/template/${TEMPLATE_ID}" \
--header 'Accept: application/json' \
--header "Authorization: $SANDBOX_TOKEN"Will update template properties excluding templateStatus
curl -X POST --location "${APIG_STAGE}/v1/template/${TEMPLATE_ID}" \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header "Authorization: $SANDBOX_TOKEN" \
--data '{
"name": "<string>",
"message": "<string>",
"templateType": "SMS",
"subject": "<string>"
}'currently limited to 50 items
curl --location "${APIG_STAGE}/v1/templates" \
--header 'Accept: application/json' \
--header "Authorization: $SANDBOX_TOKEN"Will create a single template.
curl -X POST --location "${APIG_STAGE}/v1/template" \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header "Authorization: $SANDBOX_TOKEN" \
--data '{
"templateType": "EMAIL",
"name": "<string>",
"message": "<string>",
"subject": "<string>"
}'Will create a single letter template. The CSV form part is optional. Do not set a content type header as this must be auto-generated by curl, so that it includes a form-data boundary.
PDF_PATH="./tests/test-team/fixtures/pdf-upload/with-personalisation/template.pdf"
CSV_PATH="./tests/test-team/fixtures/pdf-upload/with-personalisation/test-data.csv"curl -X POST --location "${APIG_STAGE}/v1/letter-template" \
--header 'Accept: application/json' \
--header "Authorization: $SANDBOX_TOKEN" \
--form "letterPdf=@${PDF_PATH};type=application/pdf;filename=template.pdf" \
--form "testCsv=@${CSV_PATH};type=text/csv;filename=test.csv" \
--form 'template={
"templateType": "LETTER",
"name": "example letter",
"letterType": "x0",
"language": "en"
}'Will delete a single template.
curl -X POST --location "${APIG_STAGE}/v1/template/${TEMPLATE_ID" \
--header "Authorization: $SANDBOX_TOKEN"Will submit a template.
curl -X PATCH --location "${APIG_STAGE}/v1/template/${TEMPLATE_ID}/submit" \
--header 'Accept: application/json' \
--header "Authorization: $SANDBOX_TOKEN"Will trigger a proof request for the template.
curl -X POST --location "${APIG_STAGE}/v1/template/${TEMPLATE_ID}/proof" \
--header 'Accept: application/json' \
--header "Authorization: $SANDBOX_TOKEN"curl --location "${APIG_STAGE}/v1/client-configuration" \
--header 'Accept: application/json' \
--header "Authorization: $SANDBOX_TOKEN"curl --location "${APIG_STAGE}/v1/routing-configuration/${ROUTING_CONFIG_ID}" \
--header 'Accept: application/json' \
--header "Authorization: $SANDBOX_TOKEN"curl --location "${APIG_STAGE}/v1/routing-configurations \
--header 'Accept: application/json' \
--header "Authorization: $SANDBOX_TOKEN"curl -X POST --location "${APIG_STAGE}/v1/routing-configuration" \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header "Authorization: $SANDBOX_TOKEN" \
--data '{
"campaignId": "campaign",
"cascade": [{
"cascadeGroups": ["standard"],
"channel": "EMAIL",
"channelType": "primary",
"defaultTemplateId": "email_id"
}],
"cascadeGroupOverrides": [{ "name": "standard" }],
"name": "RC name"
}'