Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Expand
titleGet information for all the tables (GET)

METHOD

URL

Data

GET

/rest/lookuprestresource/1.0/lookup/table

Return an array of table information

Example

Code Block
[
   {
      "columns":[
         {
            "id":4,
            "name":"Application"
         },
         {
            "id":5,
            "name":"App Owner"
         }
      ],
      "name":"App Mapping",
      "id":2
   }
]

Sample code

Code Block
//Get information for all the tables
def data = sendGetRequest("/rest/lookuprestresource/1.0/lookup/table/")
data.each{val -> 
  //TODO
}
Expand
titleAdd a new table (POST)

METHOD

URL

Data

POST

/rest/lookuprestresource/1.0/lookup/table

The data should be a valid JSON string containing the following information:

  • Name of the new table

  • Columns name of the new table

Example

Code Block
{
   "name":"New_Table",
   "columns": ["Column_1, Column_2"]
}

Sample code

Code Block
def bodyData = 'data={"name":"New_Table","columns":["Column_1","Column_2"]}'
def responseData = sendPostRequest("/rest/lookuprestresource/1.0/lookup/table",bodyData)
//{columns=[{id=22, name=Column_1}, {id=23, name=Column_2}], name=New_Table, id=11}
Expand
titleUpdate an existing table (PUT)

METHOD

URL

Data

PUT

/rest/lookuprestresource/1.0/lookup/table/{TABLE_NAME}

The data should be a valid JSON string containing the following information:

  • Name of the table

  • Columns name of the table

  • Mode of the action

    • append: Add the entries to the existing table. New table will be created if no existing table is found

    • overwrite: Remove the existing table and add the entries

  • Entries of the table

    • The first entry must be the column names

Example

Code Block
{
   "name":"New_Table",
   "columns": ["Column_1, Column_2"],
   "mode": "overwrite",
   "result":[["Column_1","Column_2"],["admin","This is a message"]]
}

Sample code

Code Block
def bodyData = '{"name":"New_Table","columns":["Column_1","Column_2"],"mode":"overwrite","result":[["Column_1","Column_2"],["admin","This is a message"]]}';
def responseData = sendPutRequest("/rest/lookuprestresource/1.0/lookup/table/New_Table",bodyData)
Expand
titleDelete an existing table (DELETE)

METHOD

URL

Data

DELETE

/rest/lookuprestresource/1.0/lookup/table/{TABLE_ID}

-

Sample code

Code Block
//Delete the data for table id 2
sendDeleteRequest("/rest/lookuprestresource/1.0/lookup/table/2")

Table row

Expand
titleGet rows information for a table (GET)

METHOD

URL

Data

GET

/rest/lookuprestresource/1.0/lookup/table/{TABLE_ID}/entries

Return the an array of rows information for a table

Example

Code Block
[
   {
      "4":"Confuence",
      "5":"Leon",
      "id":7,
      "tableid":2
   },
   {
      "4":"Jira",
      "5":"admin",
      "id":15,
      "tableid":2
   }
]

Sample code

Code Block
//Get the rows information for table id 2
def data = sendGetRequest("/rest/lookuprestresource/1.0/lookup/table/2/entries")
data.each{val -> 
  //TODO
}

...

Expand
titleDelete an existing row in a table (DELETE)

METHOD

URL

Data

DELETE

/rest/lookuprestresource/1.0/lookup/table/{TABLE_ID}/entries/{ROW_ID}

Sample code

Code Block
//Delete the data for row id 20
sendDeleteRequest("/rest/lookuprestresource/1.0/lookup/table/2/entries/20")

Table Column

Expand
titleGet columns information for a table (GET)

METHOD

URL

Data

GET

/rest/lookuprestresource/1.0/lookup/table/{TABLE_ID}/columns

Return the columns information for a table

Example

Code Block
{
   "columns":[
      {
         "id":4,
         "name":"Application"
      },
      {
         "id":5,
         "name":"App Owner"
      }
   ],
   "name":"App Mapping",
   "id":2
}

Sample code

Code Block
//Get the columns information for table id 2
def data = sendGetRequest("/rest/lookuprestresource/1.0/lookup/table/2/columns")
data.each{val -> 
  //TODO
}

...