Create a transform
POST/v1/transformspreview
Create a transform that destinations or sources of its kind can link. With code it starts as an unpublished draft, so nothing runs it until you publish. Creating a destination transform needs destinations:write, a source transform sources:write; without it the answer is 403. Refused with 400 without exactly one of code and managed, or for a managed version PayloadPuffin does not have.
Body
kindstring Requireddestination: maps an event payload to the request a destination receives. source: builds an event from the request a source receives. A transform links only to resources of its kind.
Allowed values: "destination", "source"
namestring RequiredA name for people.
1 to 120 characters
codestring OptionalThe first draft. Send code or managed, not both.
1 to 16384 characters
managedobject OptionalA managed transform version to run in place of code. Only source transforms can be pinned.
providerstring RequiredThe provider whose managed transform builds the events, such as the service sending the webhooks.
1 to 64 characters
versioninteger RequiredThe version of the managed transform. A version never changes once published.
At least 1
Returns
The command completed.201
dataobject RequiredCode that destinations or sources link: one saved draft and the one live code, or a managed pin.
idstring RequiredA transform ID, starting with tfm_.
kindstring Requireddestination: maps an event payload to the request a destination receives. source: builds an event from the request a source receives. A transform links only to resources of its kind.
Allowed values: "destination", "source"
namestring RequiredA name for people.
1 to 120 characters
managedobject | null RequiredThe managed transform version this transform runs in place of code of its own.
draftobject | null RequiredThe saved draft. Saving it changes nothing until it is published. Null when pinned.
liveobject | null RequiredThe published code every linked destination and source runs. Null until the draft is first published, or when pinned.
unpublishedChangesboolean RequiredTrue when the draft is not the live code: it was never published, or it was saved since.
destinationsobject[] RequiredThe destinations that link this transform, by name.
Show child attributesHide child attributes
idstring RequiredA destination ID, starting with dst_.
namestring RequiredIts name.
sourcesobject[] RequiredThe sources that link this transform, by name.
Show child attributesHide child attributes
idstring RequiredA source ID, starting with src_.
namestring RequiredIts name.
createdAtstring (date-time) RequiredISO 8601 timestamp.
updatedAtstring (date-time) RequiredISO 8601 timestamp.
Example
curl -X POST "https://api.payloadpuffin.com/v1/transforms" \
-H "Authorization: Bearer $PAYLOADPUFFIN_API_KEY" \
-H 'Content-Type: application/json' \
-d '{"kind":"destination","name":"example"}'{
"data": {
"id": "id",
"kind": "destination",
"name": "name",
"managed": {
"provider": "provider",
"version": 1
},
"draft": {
"code": "code",
"savedAt": "savedAt"
},
"live": {
"code": "code",
"publishedAt": "publishedAt"
},
"unpublishedChanges": true,
"destinations": [
{
"id": "id",
"name": "name"
}
],
"sources": [
{
"id": "id",
"name": "name"
}
],
"createdAt": "createdAt",
"updatedAt": "updatedAt"
}
}Errors
Errors use application/problem+json. The code member is stable; branch on it rather than on title or detail.
4XXapplication/problem+jsonThe request was rejected.