skip to main content
Input REST file syntax : Table definition entries : Primary key
  

Try DataDirect Drivers Now

Primary key

You can designate the primary key for a table by modifying the REST file. In the column object, add the #key after the data type element, separated by a comma. In the following example, the employeeID column has been designated the primary key for this table.
{
"my_table":{
"#path":[
"https://example.com/employees"
],
"employeeID":"VarChar(32),#key",
"position_title":"VarChar(46)",
"start_year":"Integer",
}
}
You an also create a composite primary key by using the #key element to designate multiple columns in a definition. For example, the values of the employeeID and position columns act as a composite key in the following:
{
"my_table":{
"#path":[
"https://example.com/employees"
],
"employeeID":"VarChar(32),#key",
"position":"Integer",#key,
"position_title":"VarChar(46)",
"start_year":"Integer",
}
}