Page tree

 

This is the latest version of the APIs.

Contents:


Performs an import of a macro package.

NOTE: You cannot import a macro that was exported from a later version of the product.

NOTE: Modification of the macro definition is not supported outside of the Trifacta application.


Version: v4

Required Permissions

NOTE: Each request to the Trifacta® platform must include authentication credentials. See API Authentication.

Request

Request Type: POST

Endpoint:

/v4/macros/package/


Request URI - Example:

/v4/macros/package

Request Body: 


Tip: You can paste the response of the exported macro page as the request.


{
    "type": "macro",
    "kind": "artifact",
    "hash": "p/zDDBNXrNf4H/E1yH1PvwfedkxOobT1",
    "metadata": {
        "lastMigration": "20191024143300",
        "trifactaVersion": "6.8.0+4.20191104073802.8b6217a",
        "exportedAt": "2019-11-06T01:26:12.430Z",
        "exportedBy": 1,
        "uuid": "6b27eee0-0034-11ea-a378-9dc0586de9fb",
        "edition": "Enterprise"
    },
    "data": {
        "name": "columnFormatCleanup",
        "description": "",
        "signature": [
            {
                "type": "column",
                "name": "Store_Nbr",
                "description": "",
                "internal": false,
                "default": null
            },
            {
                "type": "string",
                "name": "valIfMissing",
                "description": "",
                "default": "'0'"
            },
            {
                "type": "column",
                "name": "POS_Sales",
                "description": "",
                "internal": false,
                "default": null
            },
            {
                "type": "column",
                "name": "POS_Cost",
                "description": "",
                "internal": false,
                "default": null
            },
            {
                "type": "column",
                "name": "Store_Specific_Cost",
                "description": "",
                "internal": false,
                "default": null
            },
            {
                "type": "column",
                "name": "Store_Specific_Retail",
                "description": "",
                "internal": false,
                "default": null
            },
            {
                "type": "column",
                "name": "Current_HO_Retail",
                "description": "",
                "internal": false,
                "default": null
            }
        ],
        "scriptlines": [
            {
                "portId": null,
                "task": {
                    "annotations": {
                        "outputColumnAnnotations": {
                            "Store_Nbr": {
                                "type": [
                                    "Integer"
                                ],
                                "_likely_types": [
                                    [
                                        "Integer"
                                    ],
                                    [
                                        "Float"
                                    ],
                                    [
                                        "String"
                                    ],
                                    [
                                        "Phone"
                                    ],
                                    [
                                        "SSN"
                                    ]
                                ]
                            }
                        }
                    },
                    "kind": "task",
                    "type": "Set",
                    "parameters": {
                        "col": {
                            "kind": "array",
                            "type": "Array",
                            "value": [
                                {
                                    "kind": "variable",
                                    "type": "Variable",
                                    "value": "Store_Nbr"
                                }
                            ]
                        },
                        "value": {
                            "annotations": {},
                            "kind": "func",
                            "type": "IfMissing",
                            "parameters": {
                                "col": {
                                    "kind": "variable",
                                    "type": "Variable",
                                    "value": "col"
                                },
                                "true_expression": {
                                    "kind": "variable",
                                    "type": "Variable",
                                    "value": "valIfMissing"
                                }
                            }
                        }
                    },
                    "outputName": null
                },
                "tableData": null,
                "hash": "976fbac32a53354931c62adfec19af83c65feb81",
                "columnMetadata": null
            },
            {
                "portId": null,
                "task": {
                    "annotations": {
                        "outputColumnAnnotations": {
                            "POS_Sales": {
                                "type": [
                                    "Float"
                                ],
                                "_likely_types": [
                                    [
                                        "Float"
                                    ],
                                    [
                                        "String"
                                    ],
                                    [
                                        "Integer"
                                    ],
                                    [
                                        "Phone"
                                    ],
                                    [
                                        "SSN"
                                    ]
                                ]
                            },
                            "POS_Cost": {
                                "type": [
                                    "Float"
                                ],
                                "_likely_types": [
                                    [
                                        "Float"
                                    ],
                                    [
                                        "String"
                                    ],
                                    [
                                        "Integer"
                                    ],
                                    [
                                        "Phone"
                                    ],
                                    [
                                        "SSN"
                                    ]
                                ]
                            },
                            "Store_Specific_Retail": {
                                "type": [
                                    "Float"
                                ],
                                "_likely_types": [
                                    [
                                        "Float"
                                    ],
                                    [
                                        "String"
                                    ],
                                    [
                                        "Integer"
                                    ],
                                    [
                                        "Phone"
                                    ],
                                    [
                                        "SSN"
                                    ]
                                ]
                            },
                            "Store_Specific_Cost": {
                                "type": [
                                    "Float"
                                ],
                                "_likely_types": [
                                    [
                                        "Float"
                                    ],
                                    [
                                        "String"
                                    ],
                                    [
                                        "Integer"
                                    ],
                                    [
                                        "Phone"
                                    ],
                                    [
                                        "SSN"
                                    ]
                                ]
                            },
                            "Current_HO_Retail": {
                                "type": [
                                    "Float"
                                ],
                                "_likely_types": [
                                    [
                                        "Float"
                                    ],
                                    [
                                        "String"
                                    ],
                                    [
                                        "Integer"
                                    ],
                                    [
                                        "Phone"
                                    ],
                                    [
                                        "SSN"
                                    ]
                                ]
                            }
                        }
                    },
                    "kind": "task",
                    "type": "ReplacePatterns",
                    "parameters": {
                        "with": {
                            "kind": "constant",
                            "type": "String",
                            "value": "0$1"
                        },
                        "col": {
                            "kind": "array",
                            "type": "Array",
                            "value": [
                                {
                                    "kind": "variable",
                                    "type": "Variable",
                                    "value": "POS_Sales"
                                },
                                {
                                    "kind": "variable",
                                    "type": "Variable",
                                    "value": "POS_Cost"
                                },
                                {
                                    "kind": "variable",
                                    "type": "Variable",
                                    "value": "Store_Specific_Cost"
                                },
                                {
                                    "kind": "variable",
                                    "type": "Variable",
                                    "value": "Store_Specific_Retail"
                                },
                                {
                                    "kind": "variable",
                                    "type": "Variable",
                                    "value": "Current_HO_Retail"
                                }
                            ]
                        },
                        "on": {
                            "kind": "constant",
                            "type": "Pattern",
                            "value": "{start}(.{digit}{digit})"
                        },
                        "ignoreCase": {
                            "kind": "constant",
                            "type": "Bool",
                            "value": false
                        },
                        "global": {
                            "kind": "constant",
                            "type": "Bool",
                            "value": false
                        }
                    },
                    "outputName": null
                },
                "tableData": null,
                "hash": "1afc62c208223dc7949ba2daa27b2451baeb5965",
                "columnMetadata": null
            },
            {
                "portId": null,
                "task": {
                    "annotations": {
                        "outputColumnAnnotations": {
                            "POS_Sales": {
                                "type": [
                                    "Float"
                                ],
                                "_likely_types": [
                                    [
                                        "Float"
                                    ],
                                    [
                                        "String"
                                    ],
                                    [
                                        "Integer"
                                    ],
                                    [
                                        "Phone"
                                    ],
                                    [
                                        "SSN"
                                    ]
                                ]
                            }
                        }
                    },
                    "kind": "task",
                    "type": "Set",
                    "parameters": {
                        "col": {
                            "kind": "array",
                            "type": "Array",
                            "value": [
                                {
                                    "kind": "variable",
                                    "type": "Variable",
                                    "value": "POS_Sales"
                                }
                            ]
                        },
                        "value": {
                            "annotations": {},
                            "kind": "func",
                            "type": "IfMissing",
                            "parameters": {
                                "col": {
                                    "kind": "variable",
                                    "type": "Variable",
                                    "value": "col"
                                },
                                "true_expression": {
                                    "kind": "variable",
                                    "type": "Variable",
                                    "value": "valIfMissing"
                                }
                            }
                        }
                    },
                    "outputName": null
                },
                "tableData": null,
                "hash": "393b942fadf8738e71a4ac0fb58622b7b950d952",
                "columnMetadata": null
            },
            {
                "portId": null,
                "task": {
                    "annotations": {},
                    "kind": "task",
                    "type": "Filter",
                    "parameters": {
                        "action": {
                            "kind": "enumerable",
                            "type": "Enumerable",
                            "value": "Delete"
                        },
                        "row": {
                            "annotations": {},
                            "kind": "func",
                            "type": "IsMismatched",
                            "parameters": {
                                "type": {
                                    "kind": "array",
                                    "type": "Array",
                                    "value": [
                                        {
                                            "kind": "constant",
                                            "type": "String",
                                            "value": "Float"
                                        }
                                    ]
                                },
                                "col": {
                                    "kind": "variable",
                                    "type": "Variable",
                                    "value": "POS_Cost"
                                }
                            }
                        },
                        "type": {
                            "kind": "bundle",
                            "type": "Bundle",
                            "value": "custom"
                        },
                        "rowType": {
                            "kind": "bundle",
                            "type": "Bundle",
                            "value": "single"
                        }
                    },
                    "outputName": null
                },
                "tableData": null,
                "hash": "467f90468d684970eac3595d9a046f76703a8585",
                "columnMetadata": null
            }
        ]
    }
}


Response

Response Status Code - Success:  201 - Created

Response Body Example:

{
    "createdMacro": {
        "signature": [
            {
                "type": "column",
                "name": "Store_Nbr",
                "description": "",
                "internal": false,
                "default": null
            },
            {
                "type": "string",
                "name": "valIfMissing",
                "description": "",
                "default": "'0'"
            },
            {
                "type": "column",
                "name": "POS_Sales",
                "description": "",
                "internal": false,
                "default": null
            },
            {
                "type": "column",
                "name": "POS_Cost",
                "description": "",
                "internal": false,
                "default": null
            },
            {
                "type": "column",
                "name": "Store_Specific_Cost",
                "description": "",
                "internal": false,
                "default": null
            },
            {
                "type": "column",
                "name": "Store_Specific_Retail",
                "description": "",
                "internal": false,
                "default": null
            },
            {
                "type": "column",
                "name": "Current_HO_Retail",
                "description": "",
                "internal": false,
                "default": null
            }
        ],
        "id": 4,
        "name": "columnFormatCleanup",
        "description": "",
        "createdBy": 1,
        "updatedBy": 1,
        "workspaceId": 1,
        "deleted_at": null,
        "updatedAt": "2019-11-06T01:52:52.421Z",
        "createdAt": "2019-11-06T01:52:52.421Z"
    },
    "invalidSteps": []
}

Reference

See API Macros Package Get v4.

This page has no comments.