API Documentation

 

 

Qalcwise API version: 2.1.0.x

The following documentation demonstrate usage of the most common functionality of Qalcwise API. All the examples assume the API base address BASE_URL is subdomain.qalcwise.com, where "subdomain" is your company subdomain name.

 

Table of contents:

  1. Basics
  2. data types
  3. basic response
  4. basic request
  5. Authentication
  6. obtaining a token
  7. create a token
  8. Record
  9. get all records
  10. search for records
  11. get single record
  12. get multiple records with given keys
  13. add new records
  14. update records
  15. update or insert records
  16. delete all records
  17. delete single record
  18. delete multiple records with given keys
  19. Application
  20. get application instance
  21. search for application instance
  22. create application instance
  23. execute action in application instance
  24. Attachment
  25. get the list of attachments in application instance
  26. download an attachment, with given id
  27. download an attachment, with given name
  28. delete an attachment,with given id
  29. add an attachment to application instance
  30. delete an attachment with given id from application instance

 

Basics
Data Types
  1. Date is passed like:
      value : "2012-04-23"

    DateTime is passed like:
      value : "2014-05-19T18:25:43.511"

    DateTimeUTC is passed like:
      value : "2012-04-23T18:15:43.511Z"

    Boolean values are passed like:
      value : true
      value : false

    Numbers are passed like:
      value : 22
      value : 3.141592

    Strings are passed like:
      value : "some text"

Basic Response

If the response is different than GET and error is not a default(for example when resource is not found, or the Token is not provided) API error the json is returned. It always contains:

{
  IsSuccess: Boolean,
  ErrorMessage: String
}

If the request was successful the "IsSuccess" is set TRUE.

If there are errors the "IsSuccess" is set FALSE, additionally there may be a custom message in "ErrorMessage" field.

Example:

"IsSuccess": true,

"ErrorMessage": null

 

Basic Request
  1. Each API request has to have "Authorization" header with value Token and "Content-Type" header with value "application-json".

    Content-Type: application/json
    Authorization ->  Type:
    Bearer -> Token - eyJ0eXAiOiJKV1QiLCJhbGciOiJodHRwOi8vd3d3LnczLm9yZy8yM[...] 

IMPORTANT! Each Request to API has to meet the Basic Request requirement.

Authentication

Method

Path

Description

 POST

 /api/token

 Obtaining token.


Obtaining a Token

Endpoint responsible for authenticating provided credentials.

POST /api/token 

 

The user has to POST x-www-form-urlencoded user credentials together with "grant_type" (for now only "password" grant type is supported):

username: user_identifier
password: password
grant_type: password

Together with header:

"Content-Type":"application/x-www-form-urlencoded"

If the authentication request returns an error "401 - Unauthorized", it most likely means that the user is not in group API and is not authorized to use API (User can be added to group API by editing a system datatable SYSUSERINGROUP).

When User is authenticated successfully the endpoint returns the json containing "access_token", together with "token_type", who requested it and expiration information.

{
"access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJodHRwOi8vd3d3LnczLm9yZy8yMDAxLzA0L3htbGRzaWctbW9yZSNobWFjLXNoYTM4NCJ9.eyJlbWFpbCI6ImFkbWluQHRlc3QucGwiLCJ1bmlxdWVfbmFtZSI6IkFkbWluaXN0cmF0b3IiLCJodHRwOi8vcWFsY3dpc2UvY2xhaW1zL2RiaWQiOiIxLUxpc3QtU1lTVVNFUi1BRE1JTkBURVNULlBMIiwicm9sZSI6WyIqT3duZXIiLCJBRE1JTklTVFJBVE9SUyIsIkFMTCIsIkRFU0lHTkVSUyIsIlVTRUxPQ0FMQVBQUyQiLCJBUEkiXSwiaXNzIjoiUWFsY3dpc2UiLCJhdWQiOiIqIiwiZXhwIjoxNDk5OTg0OTQzLCJuYmYiOjE0OTk5NDE3NDN9.u0PeBG5nDHnhVooXSQ_X_Rgq5riV4ybETs_7db6L8YcDLG3IMw6zprD--gQ7FqRC",
 "token_type": "bearer",
 "expires_in": 43199
}

"access_token" and "token_type" are the most important. They are used to create the Token value that should be stored by the Client using the API.

 

Create a Token

Concatenate values "token_type" with "access_token" from /api/token JSON response.

IMPORTANT!: The "token_type" with "access_token" have to be space( " " ) separated.

Example token:
"bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJodHRwOi8vd3d3LnczLm9yZy8yMDAxLzA0L3htbGRzaWctbW9yZSNobWFjLXNoYTM4NCJ9.eyJlbWFpbCI6ImFkbWluQHRlc3QucGwiLCJ1bmlxdWVfbmFtZSI6IkFkbWluaXN0cmF0b3IiLCJodHRwOi8vcWFsY3dpc2UvY2xhaW1zL2RiaWQiOiIxLUxpc3QtU1lTVVNFUi1BRE1JTkBURVNULlBMIiwicm9sZSI6WyIqT3duZXIiLCJBRE1JTklTVFJBVE9SUyIsIkFMTCIsIkRFU0lHTkVSUyIsIlVTRUxPQ0FMQVBQUyQiLCJBUEkiXSwiaXNzIjoiUWFsY3dpc2UiLCJhdWQiOiIqIiwiZXhwIjoxNDk5OTg0OTQzLCJuYmYiOjE0OTk5NDE3NDN9.u0PeBG5nDHnhVooXSQ_X_Rgq5riV4ybETs_7db6L8YcDLG3IMw6zprD--gQ7FqRC"

Token is the way that the user is authenticated and authorized on the server side. Each API Request which requires authentication has to have it as "Authorization" header.

 

Record

Contains all the basic CRUD functionality for records in definitions.

 

Method

Path

Description

 GET

 /api/record/{name}

 Get all records

 GET

 /api/searchrecord/{name}

 Search for records

 GET

 /api/record/{name}/{recordID}

 Get single record

 POST

 /api/getrecords/{name}

 Get multiple records with given keys

 POST

 /api/record/{name}

 Add new records

 PUT

 /api/record/{name}

 Update records

 PUT

 /api/recordupsert/{name}

 Update or insert records

 DELETE

 /api/deleteallrecords/{name}

 Delete all records

 DELETE

 /api/record/{name}/{recordID}

 Delete single record

 DELETE

 /api/record/{name}

 Delete multiple records with given keys

 

name - Name of the Definition we want to get records from

recordID - Unique ID of a record(can be a single value or composite).

 

Get all records

Get all records of given definition, offset and limit can be specified.

GET /api/record/{name}?offset=0&limit=0

Parameters:

  • offset - how many records should be skipped

    optional: true

    type: integer >= 0

  • limit - limits number of returned records

    optional: true

    type: integer >=0

json returned:

[
   {
       "_id": "1-List-SYSUSER-JOHN.DOE@GO.COM",
       "IDENTIFIER": "JOHN.DOE@GO.COM",
       "EMAIL": "JOHN.DOE@GO.COM",
       "NAME": "JOHN DOE",
       "ISACTIVE": true,
   },
   {
       "_id": "1-List-SYSUSER-TESTUSERID",
       "IDENTIFIER": "TESTUSERID",
       "EMAIL": "test@go.com",
       "NAME": "Test User"
        "ISACTIVE": true,
   }
]

Explanation:

This Method is responsible for getting rows(records) from the given definition, either List or a Table. If no limit and no offset are specified the Response should contain all the rows stored within that definition. Offset parameter specifies how many initial records should be skipped. Limit parameter limits number of returned rows to given value. Both Parameters are optional and should have values bigger or equal 0.

Example:

GET /api/record/sysuser?offset=5&limit=10 - skipps first 5 records and gets next 10 from sysuser

Get single record

Get single record by id.

GET api/record/{name}/{recordID}

json returned: 

{
  "_id": "1-List-SYSUSER-JOHN.DOE@GO.COM",
  "IDENTIFIER": "JOHN.DOE@GO.COM",
  "EMAIL": "JOHN.DOE@GO.COM",
  "NAME": "JOHN DOE",
  "ISACTIVE": true
 }

Explanation:

Gets the uniquely identifiable record from given definition and returns it as json.

404 - record doesn’t exist

 

Example:

GET /api/record/USER-LIST/1

 

Search for records

Search for records of given definition, version > 2.1.0.x.

 

GET api/recordsearch/{name}?filter=QUERY&select=COLUMN_LIST&limit=LIMIT&bookmark=BOOKMARK

 

Parameters:

  • filter - query parameter to retrieve just a subset of a collection - use Lookup query syntax

    optional: true

    type: string

  • select - coma separated list of columns that will be returned

    optional: true

    type: string

  • limit - limits number of returned records

    optional: true

    type: integer (max 200)

  • bookmark - bookmark parameter allows to get next page of results

json returned: 

{
   "NextPageUrl": "next page URL with bookmark parameter filled",
   "TotalRecordCount": 2,
   "Records": [
       {
           "_id": "1-List-SYSUSER-JOHN.DOE@GO.COM",
           "EMAIL": "JOHN.DOE@GO.COM",
           "NAME": "John Doe"
       },
       {
           "_id": "1-List-SYSUSER-TESTUSERID",
           "EMAIL": "test@go.com",
           "NAME": "Test User"
       }
   ]
}

 

Explanation:

Search for records from given definition according to filter parameter and returns records data specified.

404 - record doesn’t exist

 

Example:

GET /api/recordsearch/sysuser?filter=email>'d'&select=_id,email,name&limit=1

GET /api/recordsearch/sysuser?filter=created>DATE(2020,1,1)&select=_id,email,name

 

Get multiple records with given keys

Get multiple records with given keys.

 

POST /api/getrecords/{name}

 

Explanation:

This method needs a structure which contains rows with single or composite keys for rows. Those rows that have matching records in a provided by {name} definition are returned in a JSON.

Structure (Array of objects):

[
  {
    "KeyField" : value,
    "KeyField2" : value2
  }
]

Gets 2 rows from TEST_TABLE, with given id, first row key(1, abc), second row key(11, abc)

Example:

[
  {
    "TYPE" : 1,
    "NAME" : "cheapProduct"
  },
  {
    "TYPE" : 2,
    "NAME" : "secondProduct"
  }
]
json returned: 

[
  {
        "_id": 1,
        "NAME": "cheapProduct",
        "PRICE": 20
       },
       {
         "_id": 11,
         "NAME": "elevenProduct",
         "PRICE": 10
       }
  ]

Example:

POST /api/getrecords/TEST-TABLE

 

Add new records

Add one or more records.

POST /api/record/{name}

Explanation:

Saves the records provided in the model to definition with {name}.

Structure (Array of objects):

[
  {
    "KeyField" : value,
    "KeyField2" : value2,
    "Field" : value3
  }
]

key - column name

Example:

[
  {
    "TYPE" : 2,
    "NAME" : "newProduct",
    "COUNT" : 331
  },
  {
    "TYPE" : 2,
    "NAME" : "newerProduct",
    "COUNT" : 241
  }
]

json returned:

{
"Records": [

{
Issuccess": true,
CreatedId : "1-DataTable-Table_API-7",
"Errors": []
},

{
"IsSuccess":true,
"CreatedId": "1-DataTable-TABLE_API-8",
"Errors":[]
}

    ],
"IsSuccess":true,
"ErrorMessage":null
}

POST /api/record/PRODUCTS

Update records

Update one or more records.

PUT /api/record/{name}

Explanation:

Updates the records provided in the model. If the record is nonexistent it does NOT create it.Update record only if we have an key column. The row to be updated is determined by the key values, they can not be updated. Only the other values which do not belong to the key are updated.

Structure:

[
  {
    "KeyField" : value,
    "KeyField2" : value2,
    "Field" : value3
  }
] 

Example:

The row defined by composite key(2, "newProduct") will have updated non Key Column "count" value to  1337.

[
  {
     "TYPE" : 2,
     "NAME" : "newProduct",
     "COUNT" : 1337
   }
]

json returned:

{
"Records": [
{
Issuccess": true,
CreatedId : "1-DataTable-Table_API-2",
"Errors": []
},
 ],
"IsSuccess":true,
"ErrorMessage":null
}

Example:

PUT /api/record/PRODUCTS

update or insert records

Upsert (Update or Insert) multiple records.

PUT /api/recordupsert/{name}

Explanation:

Updates or inserts the records provided in the model. If the record is nonexistent it is created it, if it exists it is updated. For the records that exist, the row to be updated is determined by the key values, they can not be updated. Only the other values which do not belong to the key are updated. Records that do not exist are created and added to definition with {name}.

If the record exists the row defined by composite key(3, "someProduct"), will have updated non Key Column "count" value to  300. However if the record does not exists it will be created instead.

Structure:

[
  {
    "KeyField" : value,
    "KeyField2" : value2,
    "Field" : value3
  }
] 

Example:

[
  {
     "TYPE" : 3,
     "NAME" : "someProduct",
     "COUNT" : 300
   }
]

json returned:

{
"Records": [
{
Issuccess": true,
CreatedId : "1-DataTable-PRODUCTS-3",
"Errors": []
},
  ],
"IsSuccess":true,
"ErrorMessage":null
}

Example:

PUT /api/recordupsert/PRODUCTS

Delete all records

Delete all records from definition.

DELETE api/deleteallrecords/{name}

Explanation:

Deletes all the records that are currently in a definition with given name.

json returned:

{
"Records": [

{
Issuccess": true,
CreatedId : "1-DataTable-TEST_TABLE-1",
"Errors": []
},
{
Issuccess": true,
CreatedId : "1-DataTable-TEST_TABLE-2",
"Errors": []
},
{
Issuccess": true,
CreatedId : "1-DataTable-TEST_TABLE-3",
"Errors": []
},
  ],
"IsSuccess":true,
"ErrorMessage":null
}

Example:

DELETE  /api/deleteallrecords/TEST_TABLE

 

Delete single record

Delete single record.

DELETE /api/record/{name}/{recordID}

Explanation:

Deletes an exact record identified by ID,  from definition with given name.

Example:

DELETE  /api/record/TEST_TABLE/1

json returned:

{
"Records": [

{
Issuccess": true,
CreatedId : "1-DataTable-TEST_TABLE-1",
"Errors": []
}
  ],
"IsSuccess":true,
"ErrorMessage":null
}

 

Delete multiple records with given keys

Delete selected rows.

DELETE /api/record/{name}

Explanation:

This method needs a model which contains rows with single or composite keys for rows. Those rows that have matching records in a provided by {name} definition are removed.

This will delete from TEST-TABLE the row with composite key(2,"valuableProduct")

REMARK!: Not all values of columns for the row are necessary, it is enough to provide only row values of columns which are marked as keys.

Structure (Array of objects):

[
  {

    "KeyField" : value,
    "KeyField2" : value2
  }
]

key - name of the column containing key
value - value of a key for given row and column

Example:

[
  {
    "TYPE" : 2,
    "NAME" : "valuableProduct"
  }
]

json returned:

{
"Records": [

{
Issuccess": true,
CreatedId : "1-DataTable-TEST_TABLE-2",
"Errors": []
}
  ],
"IsSuccess":true,
"ErrorMessage":null
}

Example:

DELETE /api/record/TEST_TABLE

 

Application

Enables simple Application interaction in forms of, executing actions on instances and distributing applications to users.

 

Method

Path

Description

 GET

 /api/app/{appID}

 Get application instance data

 GET

 /api/saerchapp/

 Search for application instances

 POST

 /api/app/

 Distribute application to users

 PUT

 /api/app/{appID}

 Execute action in application instance

 

Get application instance

Get one application data, version > 2.1.0.x

 

GET /api/app/{appID}

Parameters:

  • appID - application instance ID

    optional: false

    type: string

json returned: 

{
   "_id": "1-App-APISEARCH-3-7526f7cafbeb4e86b7c9b4a7a192cb47",
   "_archived": false,
   "_modified": "2021-05-28T11:20:44.679Z",
   "_editor": "ADMINUSER",
   "_from": "ADMINUSER",
   "_message": "",
   "_state": "saved",
   "ALIAS_TEXT": "some text",
   "ALIAS_NUMBER": 33.0,
   "ALIAS_BOOLEAN": false,
   "_attachments": [
       {
           "Id": "ea3026ad885a443db959f7f52602b715",
           "Name": "logo.pdn",
           "SectionName": "SECTION5",
"Address": "SECTION5.A1"
       },
       {
           "Id": "7fd95218153647c49c667c161fc199c1",
           "Name": "history.png",
           "SectionName": "SECTION5",
"Address": "SECTION5"
       }
   ]
}

Explanation:

User can use this method to get one application instance data. Values started with underscore _ are metadata of application instance. Uppercased values are application aliases.

Examples:

GET /api/app/1-App-APISEARCH-3-7526f7cafbeb4e86b7c9b4a7a192cb47

 

 

Search application instance

Search for application instances of given application, version > 2.1.0.x.

GET api/appsearch/{name}?filter=QUERY&select=COLUMN_LIST&limit=LIMIT&bookmark=BOOKMARK

Parameters:

  • filter - query parameter to retrieve just a subset of a collection - use Lookup query syntax

    optional: true

    type: string

  • select - coma separated list of values that will be returned

    optional: true

    type: string

  • limit - limits number of returned records

    optional: true

    type: integer (max 200)

  • bookmark - bookmark parameter allows to get next page of results

Explanation:

Search for application instances from given definition according to filter parameter and returns records data specified.

404 - record doesn’t exist

json returned: 

{
   "NextPageUrl": "https://DOMAIN/api/appsearch/APP_NAME?bookmark=g2wAAAABaANkABFjb3VjaGRiQGxvY2FsaG9zdGwAAAACYQBuBAD_____amgCRj_1k3lAAAAAYQlq",
   "TotalRecordCount": 10,
   "Records": [
       {
           "_id": "1-App-APP_NAME-1-b80448fa12244fecb88d53de5933c1c3",
           "_archived": false,
           "_modified": "2021-05-26T11:02:15.846Z",
           "_editor": null,
           "_from": "ADMIN",
           "_message": "",
           "_state": "saved",
           "A_TEXT": "AAA",
           "A_DATA": "2021-05-13",
           "A_DATACZAS": "2021-05-29T16:18:00.000",
           "A_UTC": "2021-05-01T05:30:00.000Z",
           "A_NUMBER": 12.34,
           "A_BOOLEAN": true
       },
       {
           "_id": "1-App-APP_NAME-1-98ff54fcd1e049d68579b06e46fdf24d",
           "_archived": false,
           "_modified": "2021-05-26T11:02:31.017Z",
           "_editor": null,
           "_from": "ADMIN",
           "_message": "",
           "_state": "saved",
           "A_TEXT": "BBB",
           "A_DATA": "2021-03-17",
           "A_DATACZAS": "2021-05-13T05:25:00.000",
           "A_UTC": "2021-05-16T14:20:00.000Z",
           "A_NUMBER": 23.0,
           "A_BOOLEAN": false
       }
]
}

 

Example:

GET /api/appsearch/APP_NAME?filter=A_TEXT>'a'&select=_id,_from,A_TEXT&limit=1

 

Create application instance

Distribute application.

POST /api/app

Explanation:

User can use this method to distribute the application to either one or many of the defined groups or to list of users by providing their emails. Application to be distributed is defined using a unique "Identifier", its name. Provided "InputParameters" will be passed as input parameters for each created instance of the application.

User needs to have editor permissions in an app definition in order to be able to distribute it.

Structure:

Identifier: String

DestinationUsers: Array of [String] - optional

DestinationGroups: Array of [String] - optional

InputParameters:[
  {
    "ParameterName": Value
  }
]

Examples:

Distributing App with input parameters:

{
  "Identifier" : "PARAMETERSTEST",
  "inputParameters" : {
    "INPUTBOOLEANVALUE" : true,
    "INPUTSTRINGTEXT" : "second parameter"
  },
  "DestinationGroups" : ["All"],
}

Examples:

POST /api/instance

 

Execute action in application instance

Execute workflow Action.

POST /api/app/{appID}

Explanation:

User can use this method to execute a defined workflow action. There are multiple requirements that have to be met to execute this. User needs to be an editor at current state. Current State has to have defined workflow step for the action trying to execute. 

Remark: It doesn't matter if the action is visible or not, as long as the execution condition is met it will be executed.

Structure:

Action: String

Action is the case sensitive name of the action we want to execute.
{AppID} from URL  is an actual ID of an instance of application(can be viewed for example when visiting a saved instance of an application from the main stream, the ID is part of the url).

Example:

{
  "Action" : "actionname",
}

PUT /api/instance/1-App-TESTAPP-1-743bf042411c405d91588317c82d5c55

 

Attachment

Enables simple attachment management in application instances or data records.

 

Method

Path

Description

GET

/api/attachment/{id}

Get the list of attachments in app instance or record

GET

/api/attachment/id/{id}

Download an attachment by attachment id

GET

/api/attachment/{id}?attachmentId=AttId

Download an attachment with given id from app instance or data record

GET

/api/attachment/{id}?attachmentName=Name

Download an attachment with given name from app instance or data record

POST

/api/attachment/{instanceId}/{sectionAddress}/?action=ActionName

Add attachment to given section and save the instance by executing a workflow action

POST

/api/attachment/{recordId}/{column}

Add attachment to given column on data record

DELETE

/api/attachment/{instanceID}/{sectionAddress}/?attachmentId=Id&action=ActionName

Delete an attachment with given id from section and save the instance by executing a workflow action

DELETE

/api/attachment/{recordID}/{column}?attachmentId

Delete an attachment with given name from section and save the instance by executing a workflow action

 

Get the list of attachments in application instance

Get a list of application instance attachments 

GET /api/attachment/{InstanceID}

Explanation:

This method returns the list of attachments currently stored in an application instance.

json returned:

{

  "Attachments: [

        {

          "SectionName": "SECTION1",

          "Address": "SECTION1.B1",

          "Id": "7c72fbdfaa4e4b978d60b97417356ca2",

          "Name": "Dokument01.docx"

        },

        {

          "SectionName": "SECTION1",

          "Address": "SECTION1.B2",

            "Id": "8d546e53184d404ea342b8766212b523",

            "Name": "Dokument02.docx"

        },

        {

          "SectionName": "SECTION1",

          "Address": "SECTION1.B3",

            "Id": "b142bdb2fef441ffa5d69fe4c17d457f",

            "Name": "Dokument03.docx"

        }

    ],

  "IsSuccess": true,

  "ErrorMessage": null

Example:

GET /api/attachment/1-App-EXAMPLEAPP-1-7cc1ea9d268b495eaedf49b9a2a08c3d

 

REMARK!: This returns attachments stored in all sections of type Attachment and Image.

 

Download an attachment by attachment id

Download a specific attachment from application instance 

GET /api/attachment/{InstanceID}?attachmentId=SomeAttachmentId

Parameters:

  • name: attachmentId

optional: false

type: string

Explanation:

This method downloads the attachment specified by attachmentId parameter.

Example:

GET /api/attachment/1-App-EXAMPLEAPP-1-7cc1ea9d268b495eaedf49b9a2a08c3d?attachmentId=ea3026ad885a443db959f7f52602b715

 

REMARK!: To know the exact name of the attachment it is best to first get using API the list of all attachments stored in the given application instance.

 

download an attachment, with given name

Download a specific attachment from application instance 

GET /api/attachment/{InstanceID}?attachmentName=SomeAttachmentName

Parameters:

  • name: attachmentName

optional: false

type: string

Explanation:

This method downloads the attachment specified by attachmentName parameter.

Example:

GET /api/attachment/1-App-EXAMPLEAPP-1-7cc1ea9d268b495eaedf49b9a2a08c3d?attachmentName=companylogo.jpg 

REMARK!: To know the exact name of the attachment it is best to first get using API the list of all attachments stored in the given application instance.

Delete an attachment, with given id

Delete an attachment from application instance 

DELETE /api/attachment/{InstanceID}/{SectionName}?action=ActionName&attachmentId=SomeAttachmentId

Parameters:

  • name: attachmentId
  • name: SectionName 

optional: false

type: string

  • name: action

optional: false

type: string

Explanation:

This method deletes the attachment specified by attachmentName parameter and executes the action on given instance to save the changes.

Example:

DELETE /api/attachment/1-App-EXAMPLEAPP-1-7cc1ea9d268b495eaedf49b9a2a08c3d/SECTION2?action=Save&attachmentId=ea3026ad885a443db959f7f52602b715

json returned:

{

  "ExecutedAction": {

      "CurrentWorkflowState": "Saved",

      "PreviousWorkflowState": "Added",

      "AppInstanceId": "1-App-TEST_BUG-4-18df974b9ec24d64a0f88e0609df3a08",

      "IsSuccess: true,

      "ErroeMessage": ""

    },

  "IsSuccess": true,

  "ErrorMessage": ""

}

REMARK!: To know the exact name of the attachment it is best to first get using API the list of all attachments stored in the given application instance.

 

Add an attachment to application instance

Add attachments to application instance

POST  /api/attachment/{InstanceID}/{SectionName}?action=ActionName

Parameters:

  • name: SectionName
  • name: action

optional: false

type: string

Explanation:

This method adds the attachments included in the request in the form and executes the action to save the application instance. To add a file in the 'from-data' tab, add the appropriate attachment.

Structure: 

The request has to be of content type: multipart/form-data with loaded files that are to be saved in the application instance.

Example:

POST /api/attachment/1-App-EXAMPLEAPP-1-7cc1ea9d268b495eaedf49b9a2a08c3d/SECTION2?action=Save

Model: 

The request has to be of content type: multipart/form-data with loaded files that are to be saved in the application instance.

json returned:

{

  "CreatedAttachments":[
      {
          "SectionName": "SECTION4",

          "Address": "SECTION4",

          "Id": "1840ffdd436f4ba8818f41f2ab89e0f6",

          "Name": "NT.xlsx"
      }
    ],

  "ExecutedAction": {

      "CurrentWorkflowState": "Saved",

      "PreviousWorkflowState": "Added",

      "AppInstanceId": "1-App-TEST_BUG-4-c8801d708d3c46d5ac4d1facb1d91756",

      "IsSuccess": true,

      "ErroeMessage": ""
    },

  "IsSuccess": true,

  "ErrorMessage": ""
}

 

REMARK!: In the multipart/form-data only the name of the file matters, and the file is saved under that name. If the name is a duplicate the consecutive incremented integer is added at the end of the name before the file type to make it unique. (It is best to take a look at what was stored after POST)

 

Delete an attachment with given id from application instance or data record

Delete an attachment from application instance or data record

DELETE /api/attachment/{id}/{address}?attachmentId=SomeAttachmentId&action=ActionName
DELETE /api/attachment/{id}/{address}?attachmentId=SomeAttachmentId

Parameters:

  • id - app instance id or data record id

          optional: false

          type: string

  • address - section name, cell address or column name

          optional: false

          type: string

  • attachmentId- id of attachment to remove

          optional: true

          type: string

  • action - for app instances only, workflow action to be performed in order to save attachment in app instance

          optional: true

          type: string

 

Explanation:

This method deletes the attachment specified by attachmentId parameter and saves data record or executes the action on given instance to save the changes.

 

Example:

DELETE /api/attachment/1-App-EXAMPLEAPP-1-7cc1ea9d268b495eaedf49b9a2a08c3d?action=Save&attachmentId=ea3026ad885a443db959f7f52602b715

 

json returned when delete attachments from instance:

{
"ExecutedAction": {
"CurrentWorkflowState" : "saved",
"PreviousWorkflowState" : "saved",
"AppInstanceId" : "1-App-ATT-1-f12213123e1231ef23342",
"IsSuccess": true,
"ErrorMEssage": null
},
"IsSuccess": true,
"ErrorMEssage": null
}

 

json returned when delete attachments from record:

{
"IsSuccess": true,
"ErrorMEssage": null
{

 

 

REMARK!: To know the exact name of the attachment it is best to first get using API the list of all attachments stored in the given application instance.

 

REMARK!: if address contains dot character for example SECTION1.A1 add / before action parameter

Have more questions? Submit a request

0 Comments

Article is closed for comments.
Powered by Zendesk