I duplicated previously but it had the same issue, took a look in code view and compared with other files but didn’t see anything obviously wrong.
It wouldn’t allow me to delete steps either.
I was able to recreate without issue and add the additional steps - so I’m relatively happy just wouldn’t want this to happen with a more complex api.
API code is below.
<?php
require('../../../dmxConnectLib/dmxConnect.php');
$app = new \lib\App();
$app->define(<<<'JSON'
{
"meta": {
"options": {
"linkedFile": "/infocentre.php",
"linkedForm": "uploadDoc"
},
"$_POST": [
{
"type": "text",
"fieldName": "doc_title",
"options": {
"rules": {
"core:required": {
"param": ""
}
}
},
"name": "doc_title"
},
{
"type": "text",
"fieldName": "public",
"name": "public"
},
{
"type": "file",
"fieldName": "file",
"name": "file",
"sub": [
{
"name": "name",
"type": "text"
},
{
"name": "type",
"type": "text"
},
{
"name": "size",
"type": "number"
},
{
"name": "error",
"type": "text"
}
],
"outputType": "file"
},
{
"type": "text",
"fieldName": "doc_owner",
"name": "doc_owner"
},
{
"type": "text",
"fieldName": "doc_status",
"name": "doc_status"
},
{
"type": "text",
"fieldName": "doc_type",
"multiple": true,
"name": "doc_type"
},
{
"type": "text",
"name": "doc_description"
},
{
"type": "text",
"name": "saved_name"
},
{
"type": "text",
"name": "file_name"
},
{
"type": "text",
"name": "file_type"
},
{
"type": "text",
"name": "file_size"
},
{
"type": "datetime",
"name": "dateadded"
},
{
"type": "text",
"name": "status"
},
{
"type": "text",
"name": "lastupdatedby"
},
{
"type": "datetime",
"name": "lastupdated"
}
]
},
"exec": {
"steps": [
{
"name": "identity",
"module": "auth",
"action": "identify",
"options": {
"provider": "security"
},
"output": true,
"meta": []
},
{
"name": "loginData",
"module": "dbconnector",
"action": "single",
"options": {
"connection": "lfclients001",
"sql": {
"type": "select",
"columns": [
{
"table": "import_Accounts_Contacts_WK",
"column": "PolicyNumber",
"recid": 1
},
{
"table": "import_Accounts_Contacts_WK",
"column": "Name",
"recid": 2
},
{
"table": "import_Accounts_Contacts_WK",
"column": "Email",
"recid": 3
},
{
"table": "import_Accounts_Contacts_WK",
"column": "id",
"recid": 4
},
{
"table": "import_Accounts_Contacts_WK",
"column": "National ID",
"recid": 5
},
{
"table": "import_Accounts_Contacts_WK",
"column": "Contact Type",
"recid": 6
},
{
"table": "import_Accounts_Contacts_WK",
"column": "Type",
"recid": 7
},
{
"table": "import_Accounts_Contacts_WK",
"column": "username",
"recid": 8
},
{
"table": "import_Accounts_Contacts_WK",
"column": "Login ID",
"recid": 9
}
],
"params": [
{
"operator": "equal",
"type": "expression",
"name": ":P1",
"value": "{{identity}}",
"test": ""
}
],
"table": {
"name": "import_Accounts_Contacts_WK"
},
"joins": [],
"wheres": {
"condition": "AND",
"rules": [
{
"id": "import_Accounts_Contacts_WK.Login ID",
"field": "import_Accounts_Contacts_WK.Login ID",
"type": "double",
"operator": "equal",
"value": "{{identity}}",
"data": {
"table": "import_Accounts_Contacts_WK",
"column": "Login ID",
"type": "number",
"columnObj": {
"type": "integer",
"default": "0",
"primary": false,
"nullable": false,
"name": "Login ID"
}
},
"operation": "=",
"table": "import_Accounts_Contacts_WK"
}
],
"conditional": null,
"valid": true
},
"query": "select `PolicyNumber`, `Name`, `Email`, `id`, `National ID`, `Contact Type`, `Type`, `username`, `Login ID` from `import_Accounts_Contacts_WK` where `import_Accounts_Contacts_WK`.`Login ID` = ?"
}
},
"output": true,
"meta": [
{
"type": "text",
"name": "PolicyNumber"
},
{
"type": "text",
"name": "Name"
},
{
"type": "text",
"name": "Email"
},
{
"type": "number",
"name": "id"
},
{
"type": "text",
"name": "National ID"
},
{
"type": "text",
"name": "Contact Type"
},
{
"type": "text",
"name": "Type"
},
{
"type": "text",
"name": "username"
},
{
"type": "number",
"name": "Login ID"
}
],
"outputType": "object"
},
{
"name": "upload",
"module": "upload",
"action": "upload",
"options": {
"path": "/uploads",
"fields": "{{$_POST.file}}",
"throwErrors": true,
"template": "{{loginData.username}}-{{$_POST.doc_type}}-{{$_POST.secondsunix}}{ext}"
},
"meta": [
{
"name": "name",
"type": "text"
},
{
"name": "path",
"type": "text"
},
{
"name": "url",
"type": "text"
},
{
"name": "type",
"type": "text"
},
{
"name": "size",
"type": "text"
},
{
"name": "error",
"type": "number"
}
],
"outputType": "file",
"output": true
},
{
"name": "insert",
"module": "dbupdater",
"action": "insert",
"options": {
"connection": "lfclients001",
"sql": {
"type": "insert",
"values": [
{
"table": "uploads",
"column": "doc_owner",
"type": "text",
"value": "{{$_POST.doc_owner}}"
},
{
"table": "uploads",
"column": "doc_title",
"type": "text",
"value": "{{$_POST.doc_title}}"
},
{
"table": "uploads",
"column": "doc_type",
"type": "text",
"value": "{{$_POST.doc_type}}"
},
{
"table": "uploads",
"column": "doc_description",
"type": "text",
"value": "{{$_POST.doc_description}}"
},
{
"table": "uploads",
"column": "saved_name",
"type": "text",
"value": "{{upload.name}}"
},
{
"table": "uploads",
"column": "file_name",
"type": "text",
"value": "{{upload.path}}"
},
{
"table": "uploads",
"column": "file_type",
"type": "text",
"value": "{{upload.type}}"
},
{
"table": "uploads",
"column": "file_size",
"type": "text",
"value": "{{upload.size}}"
},
{
"table": "uploads",
"column": "dateadded",
"type": "datetime",
"value": "{{NOW}}"
},
{
"table": "uploads",
"column": "status",
"type": "text",
"value": "{{$_POST.doc_status}}"
},
{
"table": "uploads",
"column": "public",
"type": "text",
"value": "{{$_POST.public}}"
},
{
"table": "uploads",
"column": "lastupdatedby",
"type": "text",
"value": "{{loginData.username}}"
},
{
"table": "uploads",
"column": "lastupdated",
"type": "datetime",
"value": "{{NOW}}"
}
],
"table": "uploads",
"returning": "id",
"query": "insert into `uploads` (`dateadded`, `doc_description`, `doc_owner`, `doc_title`, `doc_type`, `file_name`, `file_size`, `file_type`, `lastupdated`, `lastupdatedby`, `public`, `saved_name`, `status`) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)",
"params": [
{
"name": ":P1",
"type": "expression",
"value": "{{$_POST.doc_owner}}",
"test": ""
},
{
"name": ":P2",
"type": "expression",
"value": "{{$_POST.doc_title}}",
"test": ""
},
{
"name": ":P3",
"type": "expression",
"value": "{{$_POST.doc_type}}",
"test": ""
},
{
"name": ":P4",
"type": "expression",
"value": "{{$_POST.doc_description}}",
"test": ""
},
{
"name": ":P5",
"type": "expression",
"value": "{{upload.name}}",
"test": ""
},
{
"name": ":P6",
"type": "expression",
"value": "{{upload.path}}",
"test": ""
},
{
"name": ":P7",
"type": "expression",
"value": "{{upload.type}}",
"test": ""
},
{
"name": ":P8",
"type": "expression",
"value": "{{upload.size}}",
"test": ""
},
{
"name": ":P9",
"type": "expression",
"value": "{{NOW}}",
"test": ""
},
{
"name": ":P10",
"type": "expression",
"value": "{{$_POST.doc_status}}",
"test": ""
},
{
"name": ":P11",
"type": "expression",
"value": "{{$_POST.public}}",
"test": ""
},
{
"name": ":P12",
"type": "expression",
"value": "{{loginData.username}}",
"test": ""
},
{
"name": ":P13",
"type": "expression",
"value": "{{NOW}}",
"test": ""
}
]
}
},
"meta": [
{
"name": "identity",
"type": "text"
},
{
"name": "affected",
"type": "number"
}
],
"output": true
}
]
}
}
JSON
);
?>