ModelsApi Resource

This section of the API encompasses functionality to create, edit and share saved Explorer models.

See Also
ModelInfo

GET /models

For an authenticated user, this method returns all ModelInfos accessible by that user. (ModelInfo refers to a version of a Model containing meta-information, but not the full Model details).

 https://api.gavagai.se/explorer/v1/models
 

See Also
ModelInfo
Response Body
media type data type description
application/json array of ModelInfo (JSON) A list of models.

Example

Request
GET /models
Accept: application/json

              
Response
HTTP/1.1 200 OK
Content-Type: application/json

                
[ {
  "title" : "...",
  "created" : 12345,
  "id" : 12345,
  "createdBy" : {
    "userId" : "..."
  },
  "type" : "STANDARD",
  "outdated" : true,
  "language" : "..."
} ]
                
              

POST /models

Upload a model from a file (".csv" , ".xls" , ".xlsx" supported). 3 columns need to be present in the file, namely: "Index", "Label" and "Terms". Index is used as group indicator. Index Label Terms 1 Burger burger, cheeseburger, veggie burger 2 Fries fries, chips, the chips 3.1 Nice nice, good 3.2 Sweet sweet, 4 Soda soda, drinks "Label" is the name of each topic and finally "Terms" is a comma separated list of terms that should be included in the topic. An optional "Pinned" column can be present. The value should be "true" or "false".

 https://api.gavagai.se/explorer/v1/models
 

Request Parameters
name type description
encoding query Encoding of the input file. If this is left blank a 'best guess' will be made.
title query The title of the model. If this parameter is omitted the model will be initialized with a null title.
Request Body
media type data type
multipart/form-data (custom)
Response Body
media type data type description
application/json Model (JSON)

Example

Request
POST /models?title={title}
Content-Type: multipart/form-data
Accept: application/json

                
...
                
              
Response
HTTP/1.1 201 Created
Content-Type: application/json

                
{
  "title" : "...",
  "created" : 12345,
  "groups" : [ {
    "title" : "...",
    "topics" : [ {
      "title" : "...",
      "id" : 12345,
      "terms" : [ "...", "..." ],
      "dictionary" : { }
    }, {
      "title" : "...",
      "id" : 12345,
      "terms" : [ "...", "..." ],
      "dictionary" : { }
    } ],
    "id" : 12345,
    "pinned" : true
  }, {
    "title" : "...",
    "topics" : [ {
      "title" : "...",
      "id" : 12345,
      "terms" : [ "...", "..." ],
      "dictionary" : { }
    }, {
      "title" : "...",
      "id" : 12345,
      "terms" : [ "...", "..." ],
      "dictionary" : { }
    } ],
    "id" : 12345,
    "pinned" : true
  } ],
  "id" : 12345,
  "usersAccess" : [ {
    "id" : 12345,
    "rights" : "READ_WRITE",
    "created" : 12345,
    "user" : {
      "userId" : "..."
    }
  }, {
    "id" : 12345,
    "rights" : "READ",
    "created" : 12345,
    "user" : {
      "userId" : "..."
    }
  } ],
  "createdBy" : {
    "userId" : "..."
  },
  "invitations" : [ {
    "id" : 12345,
    "created" : 12345,
    "model" : {
      "title" : "...",
      "created" : 12345,
      "id" : 12345,
      "createdBy" : { },
      "type" : "MANAGED",
      "outdated" : true,
      "language" : "..."
    },
    "rights" : "READ",
    "recipient" : {
      "userId" : "..."
    }
  }, {
    "id" : 12345,
    "created" : 12345,
    "model" : {
      "title" : "...",
      "created" : 12345,
      "id" : 12345,
      "createdBy" : { },
      "type" : "DYNAMIC",
      "outdated" : true,
      "language" : "..."
    },
    "rights" : "READ",
    "recipient" : {
      "userId" : "..."
    }
  } ],
  "ignoreTerms" : [ {
    "term" : "...",
    "id" : 12345,
    "source" : { }
  }, {
    "term" : "...",
    "id" : 12345,
    "source" : { }
  } ],
  "type" : "STANDARD",
  "ignoreTermsDictionary" : { },
  "outdated" : true,
  "language" : "..."
}
                
              

POST /models/create

Creates a model from a given project. The dynamic field specifies if the project is to be connected with the model (All changes to the model will be reflected in all master and dependent projects after the exploration)

 https://api.gavagai.se/explorer/v1/models/create
 

Request Parameters
name type description constraints
projectId query The identifier of the project to import model from int
Request Body
media type data type description
application/json ModelUpdate (JSON) The information with which to update the model.
Response Body
media type data type description
application/json Model (JSON) The model containing the information.

Example

Request
POST /models/create?projectId={projectId}
Content-Type: application/json
Accept: application/json

                
{
  "title" : "...",
  "dynamic" : true
}
                
              
Response
HTTP/1.1 201 Created
Content-Type: application/json

                
{
  "title" : "...",
  "created" : 12345,
  "groups" : [ {
    "title" : "...",
    "topics" : [ {
      "title" : "...",
      "id" : 12345,
      "terms" : [ "...", "..." ],
      "dictionary" : { }
    }, {
      "title" : "...",
      "id" : 12345,
      "terms" : [ "...", "..." ],
      "dictionary" : { }
    } ],
    "id" : 12345,
    "pinned" : true
  }, {
    "title" : "...",
    "topics" : [ {
      "title" : "...",
      "id" : 12345,
      "terms" : [ "...", "..." ],
      "dictionary" : { }
    }, {
      "title" : "...",
      "id" : 12345,
      "terms" : [ "...", "..." ],
      "dictionary" : { }
    } ],
    "id" : 12345,
    "pinned" : true
  } ],
  "id" : 12345,
  "usersAccess" : [ {
    "id" : 12345,
    "rights" : "READ",
    "created" : 12345,
    "user" : {
      "userId" : "..."
    }
  }, {
    "id" : 12345,
    "rights" : "READ",
    "created" : 12345,
    "user" : {
      "userId" : "..."
    }
  } ],
  "createdBy" : {
    "userId" : "..."
  },
  "invitations" : [ {
    "id" : 12345,
    "created" : 12345,
    "model" : {
      "title" : "...",
      "created" : 12345,
      "id" : 12345,
      "createdBy" : { },
      "type" : "MANAGED",
      "outdated" : true,
      "language" : "..."
    },
    "rights" : "READ",
    "recipient" : {
      "userId" : "..."
    }
  }, {
    "id" : 12345,
    "created" : 12345,
    "model" : {
      "title" : "...",
      "created" : 12345,
      "id" : 12345,
      "createdBy" : { },
      "type" : "MANAGED",
      "outdated" : true,
      "language" : "..."
    },
    "rights" : "READ",
    "recipient" : {
      "userId" : "..."
    }
  } ],
  "ignoreTerms" : [ {
    "term" : "...",
    "id" : 12345,
    "source" : { }
  }, {
    "term" : "...",
    "id" : 12345,
    "source" : { }
  } ],
  "type" : "DYNAMIC",
  "ignoreTermsDictionary" : { },
  "outdated" : true,
  "language" : "..."
}
                
              

GET /models/invitations

Return all ModelInvitation put out to logged in user

 https://api.gavagai.se/explorer/v1/models/invitations
 

Response Body
media type data type description
application/json array of ModelInvitation (JSON) a list of ModelInvitation.

Example

Request
GET /models/invitations
Accept: application/json

              
Response
HTTP/1.1 200 OK
Content-Type: application/json

                
[ {
  "id" : 12345,
  "created" : 12345,
  "model" : {
    "title" : "...",
    "created" : 12345,
    "id" : 12345,
    "createdBy" : {
      "userId" : "..."
    },
    "type" : "STANDARD",
    "outdated" : true,
    "language" : "..."
  },
  "rights" : "READ",
  "recipient" : {
    "userId" : "..."
  }
} ]
                
              

DELETE /models/{id}

Removes the model. If the model is a dynamic model, all dependent projects will be detached from the model.

 https://api.gavagai.se/explorer/v1/models/{id}
 

Request Parameters
name type description constraints
id path The identifier for the model to remove. int

Example

Request
DELETE /models/{id}

              
Response
HTTP/1.1 204 No Content

              

GET /models/{id}

Return a Model for the given modelId.

 https://api.gavagai.se/explorer/v1/models/{id}
 

Request Parameters
name type description constraints
id path The id of the model to fetch. int
Response Body
media type data type description
application/json Model (JSON) A model.

Example

Request
GET /models/{id}
Accept: application/json

              
Response
HTTP/1.1 200 OK
Content-Type: application/json

                
{
  "title" : "...",
  "created" : 12345,
  "groups" : [ {
    "title" : "...",
    "topics" : [ {
      "title" : "...",
      "id" : 12345,
      "terms" : [ "...", "..." ],
      "dictionary" : { }
    }, {
      "title" : "...",
      "id" : 12345,
      "terms" : [ "...", "..." ],
      "dictionary" : { }
    } ],
    "id" : 12345,
    "pinned" : true
  }, {
    "title" : "...",
    "topics" : [ {
      "title" : "...",
      "id" : 12345,
      "terms" : [ "...", "..." ],
      "dictionary" : { }
    }, {
      "title" : "...",
      "id" : 12345,
      "terms" : [ "...", "..." ],
      "dictionary" : { }
    } ],
    "id" : 12345,
    "pinned" : true
  } ],
  "id" : 12345,
  "usersAccess" : [ {
    "id" : 12345,
    "rights" : "READ",
    "created" : 12345,
    "user" : {
      "userId" : "..."
    }
  }, {
    "id" : 12345,
    "rights" : "READ",
    "created" : 12345,
    "user" : {
      "userId" : "..."
    }
  } ],
  "createdBy" : {
    "userId" : "..."
  },
  "invitations" : [ {
    "id" : 12345,
    "created" : 12345,
    "model" : {
      "title" : "...",
      "created" : 12345,
      "id" : 12345,
      "createdBy" : { },
      "type" : "STANDARD",
      "outdated" : true,
      "language" : "..."
    },
    "rights" : "READ_WRITE",
    "recipient" : {
      "userId" : "..."
    }
  }, {
    "id" : 12345,
    "created" : 12345,
    "model" : {
      "title" : "...",
      "created" : 12345,
      "id" : 12345,
      "createdBy" : { },
      "type" : "STANDARD",
      "outdated" : true,
      "language" : "..."
    },
    "rights" : "READ",
    "recipient" : {
      "userId" : "..."
    }
  } ],
  "ignoreTerms" : [ {
    "term" : "...",
    "id" : 12345,
    "source" : { }
  }, {
    "term" : "...",
    "id" : 12345,
    "source" : { }
  } ],
  "type" : "DYNAMIC",
  "ignoreTermsDictionary" : { },
  "outdated" : true,
  "language" : "..."
}
                
              

PUT /models/{id}

Updates the Model information for the model identified by the id parameter. The model structure (groups and ignore terms) and the model name by updated. Each update of the model structure will result in a new version of the model being created. If the model is a dynamic model, the master project and dependent projects will reflect the change after the next explore.

 https://api.gavagai.se/explorer/v1/models/{id}
 

Request Parameters
name type description constraints
id path The identifier of the project. int
Request Body
media type data type description
application/json ModelInput (JSON) The ModelInput with which to update the model.
Response Body
media type data type description
application/json Model (JSON) The Model containing the updated information.

Example

Request
PUT /models/{id}
Content-Type: application/json
Accept: application/json

                
{
  "title" : "...",
  "groups" : [ {
    "title" : "...",
    "topics" : [ {
      "title" : "...",
      "id" : 12345,
      "terms" : [ "...", "..." ],
      "dictionary" : {
        "property1" : "...",
        "property2" : "..."
      }
    }, {
      "title" : "...",
      "id" : 12345,
      "terms" : [ "...", "..." ],
      "dictionary" : {
        "property1" : "...",
        "property2" : "..."
      }
    } ],
    "id" : 12345,
    "pinned" : true
  }, {
    "title" : "...",
    "topics" : [ {
      "title" : "...",
      "id" : 12345,
      "terms" : [ "...", "..." ],
      "dictionary" : {
        "property1" : "...",
        "property2" : "..."
      }
    }, {
      "title" : "...",
      "id" : 12345,
      "terms" : [ "...", "..." ],
      "dictionary" : {
        "property1" : "...",
        "property2" : "..."
      }
    } ],
    "id" : 12345,
    "pinned" : true
  } ],
  "ignoreTerms" : [ "...", "..." ],
  "ignoreTermsDictionary" : {
    "property1" : "...",
    "property2" : "..."
  }
}
                
              
Response
HTTP/1.1 204 No Content
Content-Type: application/json

                
{
  "title" : "...",
  "created" : 12345,
  "groups" : [ {
    "title" : "...",
    "topics" : [ {
      "title" : "...",
      "id" : 12345,
      "terms" : [ "...", "..." ],
      "dictionary" : { }
    }, {
      "title" : "...",
      "id" : 12345,
      "terms" : [ "...", "..." ],
      "dictionary" : { }
    } ],
    "id" : 12345,
    "pinned" : true
  }, {
    "title" : "...",
    "topics" : [ {
      "title" : "...",
      "id" : 12345,
      "terms" : [ "...", "..." ],
      "dictionary" : { }
    }, {
      "title" : "...",
      "id" : 12345,
      "terms" : [ "...", "..." ],
      "dictionary" : { }
    } ],
    "id" : 12345,
    "pinned" : true
  } ],
  "id" : 12345,
  "usersAccess" : [ {
    "id" : 12345,
    "rights" : "READ_WRITE",
    "created" : 12345,
    "user" : {
      "userId" : "..."
    }
  }, {
    "id" : 12345,
    "rights" : "READ",
    "created" : 12345,
    "user" : {
      "userId" : "..."
    }
  } ],
  "createdBy" : {
    "userId" : "..."
  },
  "invitations" : [ {
    "id" : 12345,
    "created" : 12345,
    "model" : {
      "title" : "...",
      "created" : 12345,
      "id" : 12345,
      "createdBy" : { },
      "type" : "MANAGED",
      "outdated" : true,
      "language" : "..."
    },
    "rights" : "READ",
    "recipient" : {
      "userId" : "..."
    }
  }, {
    "id" : 12345,
    "created" : 12345,
    "model" : {
      "title" : "...",
      "created" : 12345,
      "id" : 12345,
      "createdBy" : { },
      "type" : "STANDARD",
      "outdated" : true,
      "language" : "..."
    },
    "rights" : "READ_WRITE",
    "recipient" : {
      "userId" : "..."
    }
  } ],
  "ignoreTerms" : [ {
    "term" : "...",
    "id" : 12345,
    "source" : { }
  }, {
    "term" : "...",
    "id" : 12345,
    "source" : { }
  } ],
  "type" : "STANDARD",
  "ignoreTermsDictionary" : { },
  "outdated" : true,
  "language" : "..."
}
                
              

GET /models/{id}/projects

Return the projects which are connected and dependent to a model. The response fields will be empty if the model is not a dynamic model

Request Parameters
name type description constraints
id path The id of the Model for which the information is required int
Response Body
media type data type description
application/json ModelProjects (JSON) a list of ProjectInfo which use the specified model

Example

Request
GET /models/{id}/projects
Accept: application/json

              
Response
HTTP/1.1 200 OK
Content-Type: application/json

                
{
  "masterProject" : {
    "id" : 12345,
    "rows" : 12345,
    "created" : 12345,
    "encoding" : "...",
    "title" : "...",
    "status" : "DELETING",
    "statusMessage" : "...",
    "headers" : [ {
      "numberOfEmptyCells" : 12345,
      "NPSCandidate" : true,
      "filterable" : true,
      "id" : 12345,
      "header" : "...",
      "suggestedLanguage" : "AE",
      "columnDataSize" : 12345,
      "timeSeriesCandidate" : true
    }, {
      "numberOfEmptyCells" : 12345,
      "NPSCandidate" : true,
      "filterable" : true,
      "id" : 12345,
      "header" : "...",
      "suggestedLanguage" : "SC",
      "columnDataSize" : 12345,
      "timeSeriesCandidate" : true
    } ],
    "model" : {
      "title" : "...",
      "created" : 12345,
      "id" : 12345,
      "createdBy" : { },
      "type" : "STANDARD",
      "outdated" : true,
      "language" : "..."
    },
    "createdBy" : {
      "userId" : "..."
    }
  },
  "dependentProjects" : [ {
    "id" : 12345,
    "rows" : 12345,
    "created" : 12345,
    "encoding" : "...",
    "title" : "...",
    "status" : "ERROR",
    "statusMessage" : "...",
    "headers" : [ {
      "numberOfEmptyCells" : 12345,
      "NPSCandidate" : true,
      "filterable" : true,
      "id" : 12345,
      "header" : "...",
      "suggestedLanguage" : "ZH_CN",
      "columnDataSize" : 12345,
      "timeSeriesCandidate" : true
    }, {
      "numberOfEmptyCells" : 12345,
      "NPSCandidate" : true,
      "filterable" : true,
      "id" : 12345,
      "header" : "...",
      "suggestedLanguage" : "BO",
      "columnDataSize" : 12345,
      "timeSeriesCandidate" : true
    } ],
    "model" : {
      "title" : "...",
      "created" : 12345,
      "id" : 12345,
      "createdBy" : { },
      "type" : "MANAGED",
      "outdated" : true,
      "language" : "..."
    },
    "createdBy" : {
      "userId" : "..."
    }
  }, {
    "id" : 12345,
    "rows" : 12345,
    "created" : 12345,
    "encoding" : "...",
    "title" : "...",
    "status" : "APPENDING",
    "statusMessage" : "...",
    "headers" : [ {
      "numberOfEmptyCells" : 12345,
      "NPSCandidate" : true,
      "filterable" : true,
      "id" : 12345,
      "header" : "...",
      "suggestedLanguage" : "SA",
      "columnDataSize" : 12345,
      "timeSeriesCandidate" : true
    }, {
      "numberOfEmptyCells" : 12345,
      "NPSCandidate" : true,
      "filterable" : true,
      "id" : 12345,
      "header" : "...",
      "suggestedLanguage" : "EE",
      "columnDataSize" : 12345,
      "timeSeriesCandidate" : true
    } ],
    "model" : {
      "title" : "...",
      "created" : 12345,
      "id" : 12345,
      "createdBy" : { },
      "type" : "STANDARD",
      "outdated" : true,
      "language" : "..."
    },
    "createdBy" : {
      "userId" : "..."
    }
  } ]
}
                
              

POST /models/{id}/share

Create a ModelInvitation to share a model with a different user. When the user accepts the invitation the Model will be available to the user.

 https://api.gavagai.se/explorer/v1/models/{id}/share
 

Request Parameters
name type description constraints
id path The identifier of the model. int
userId query The userId of the user you want to share the model with.  
Response Body
media type data type description
application/json ModelInvitation (JSON) The ModelInvitation containing the information.

Example

Request
POST /models/{id}/share?userId={userId}
Accept: application/json

              
Response
HTTP/1.1 201 Created
Content-Type: application/json

                
{
  "id" : 12345,
  "created" : 12345,
  "model" : {
    "title" : "...",
    "created" : 12345,
    "id" : 12345,
    "createdBy" : {
      "userId" : "..."
    },
    "type" : "MANAGED",
    "outdated" : true,
    "language" : "..."
  },
  "rights" : "READ_WRITE",
  "recipient" : {
    "userId" : "..."
  }
}
                
              

GET /models/{id}/versions

Return all versions of a model that are available for a specified model. The versioning applies only to the groups and the ignore terms of a model.

 https://api.gavagai.se/explorer/v1/models/{id}/versions
 

Request Parameters
name type description constraints
id path int
Response Body
media type data type description
application/json array of ModelVersion (JSON) a list of ModelVersion.

Example

Request
GET /models/{id}/versions
Accept: application/json

              
Response
HTTP/1.1 200 OK
Content-Type: application/json

                
[ {
  "created" : 12345,
  "version" : 12345
} ]
                
              

PUT /models/invitations/{invitationId}/accept

Accept ModelInvitation which makes the model accessible. The invitation will be removed after a successful accept

 https://api.gavagai.se/explorer/v1/models/invitations/{invitationId}/accept
 

Request Parameters
name type description constraints
invitationId path The identifier of the invitation int

Example

Request
PUT /models/invitations/{invitationId}/accept

              
Response
HTTP/1.1 204 No Content

              

PUT /models/invitations/{invitationId}/reject

Reject ModelInvitation which will remove the invitation.

 https://api.gavagai.se/explorer/v1/models/invitations/{invitationId}/reject
 

Request Parameters
name type description constraints
invitationId path The identifier of the invitation int

Example

Request
PUT /models/invitations/{invitationId}/reject

              
Response
HTTP/1.1 204 No Content

              

DELETE /models/{id}/invitations/{invitationId}

Removes a model invitation sent to another user. Removing the invitation means that the user no longer will be able to accept/reject the invitation.

 https://api.gavagai.se/explorer/v1/models/{id}/invitations/{invitationId}
 

Request Parameters
name type description constraints
id path The identifier for the Model. int
invitationId path The identifier for the ModelInvitation. int

Example

Request
DELETE /models/{id}/invitations/{invitationId}

              
Response
HTTP/1.1 204 No Content

              

DELETE /models/{id}/userRights/{accessId}

Removes an access permission for this model. Removing the access permission means that the respective user no longer will have access to this model. The accessId can be found by sending a GET to /models/{id}.

 https://api.gavagai.se/explorer/v1/models/{id}/userRights/{accessId}
 

Request Parameters
name type description constraints
accessId path The identifier for the ModelAccess. int
id path The identifier for the model. int

Example

Request
DELETE /models/{id}/userRights/{accessId}

              
Response
HTTP/1.1 204 No Content

              

GET /models/{id}/versions/{version}

Returns a specific version of a Model for the given modelId and version. The versioning applies only to the groups and the ignore terms of a model.

 https://api.gavagai.se/explorer/v1/models/{id}/versions/{version}
 

Request Parameters
name type description constraints
id path The id of the model to fetch. int
version path The version of the model to fetch. int
Response Body
media type data type description
application/json Model (JSON) A version of a model.

Example

Request
GET /models/{id}/versions/{version}
Accept: application/json

              
Response
HTTP/1.1 200 OK
Content-Type: application/json

                
{
  "title" : "...",
  "created" : 12345,
  "groups" : [ {
    "title" : "...",
    "topics" : [ {
      "title" : "...",
      "id" : 12345,
      "terms" : [ "...", "..." ],
      "dictionary" : { }
    }, {
      "title" : "...",
      "id" : 12345,
      "terms" : [ "...", "..." ],
      "dictionary" : { }
    } ],
    "id" : 12345,
    "pinned" : true
  }, {
    "title" : "...",
    "topics" : [ {
      "title" : "...",
      "id" : 12345,
      "terms" : [ "...", "..." ],
      "dictionary" : { }
    }, {
      "title" : "...",
      "id" : 12345,
      "terms" : [ "...", "..." ],
      "dictionary" : { }
    } ],
    "id" : 12345,
    "pinned" : true
  } ],
  "id" : 12345,
  "usersAccess" : [ {
    "id" : 12345,
    "rights" : "READ_WRITE",
    "created" : 12345,
    "user" : {
      "userId" : "..."
    }
  }, {
    "id" : 12345,
    "rights" : "READ_WRITE",
    "created" : 12345,
    "user" : {
      "userId" : "..."
    }
  } ],
  "createdBy" : {
    "userId" : "..."
  },
  "invitations" : [ {
    "id" : 12345,
    "created" : 12345,
    "model" : {
      "title" : "...",
      "created" : 12345,
      "id" : 12345,
      "createdBy" : { },
      "type" : "STANDARD",
      "outdated" : true,
      "language" : "..."
    },
    "rights" : "READ_WRITE",
    "recipient" : {
      "userId" : "..."
    }
  }, {
    "id" : 12345,
    "created" : 12345,
    "model" : {
      "title" : "...",
      "created" : 12345,
      "id" : 12345,
      "createdBy" : { },
      "type" : "MANAGED",
      "outdated" : true,
      "language" : "..."
    },
    "rights" : "READ_WRITE",
    "recipient" : {
      "userId" : "..."
    }
  } ],
  "ignoreTerms" : [ {
    "term" : "...",
    "id" : 12345,
    "source" : { }
  }, {
    "term" : "...",
    "id" : 12345,
    "source" : { }
  } ],
  "type" : "DYNAMIC",
  "ignoreTermsDictionary" : { },
  "outdated" : true,
  "language" : "..."
}