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
Content-Type: */*
Accept: application/json

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

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

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_WRITE",
    "created" : 12345,
    "user" : {
      "userId" : "..."
    }
  } ],
  "createdBy" : {
    "userId" : "..."
  },
  "invitations" : [ {
    "id" : 12345,
    "created" : 12345,
    "model" : {
      "title" : "...",
      "created" : 12345,
      "id" : 12345,
      "createdBy" : { },
      "type" : { },
      "latest" : true
    },
    "rights" : "READ_WRITE",
    "recipient" : {
      "userId" : "..."
    }
  }, {
    "id" : 12345,
    "created" : 12345,
    "model" : {
      "title" : "...",
      "created" : 12345,
      "id" : 12345,
      "createdBy" : { },
      "type" : { },
      "latest" : true
    },
    "rights" : "READ",
    "recipient" : {
      "userId" : "..."
    }
  } ],
  "ignoreTerms" : [ {
    "term" : "...",
    "id" : 12345,
    "source" : { }
  }, {
    "term" : "...",
    "id" : 12345,
    "source" : { }
  } ],
  "type" : "STANDARD",
  "ignoreTermsDictionary" : { },
  "latest" : true
}
                
              

POST /models/create

Creates a model from a given project.

 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" : "...",
  "synched" : 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_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" : { },
      "latest" : true
    },
    "rights" : "READ",
    "recipient" : {
      "userId" : "..."
    }
  }, {
    "id" : 12345,
    "created" : 12345,
    "model" : {
      "title" : "...",
      "created" : 12345,
      "id" : 12345,
      "createdBy" : { },
      "type" : { },
      "latest" : true
    },
    "rights" : "READ",
    "recipient" : {
      "userId" : "..."
    }
  } ],
  "ignoreTerms" : [ {
    "term" : "...",
    "id" : 12345,
    "source" : { }
  }, {
    "term" : "...",
    "id" : 12345,
    "source" : { }
  } ],
  "type" : "MANAGED",
  "ignoreTermsDictionary" : { },
  "latest" : true
}
                
              

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
Content-Type: */*
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" : { },
    "latest" : true
  },
  "rights" : "READ",
  "recipient" : {
    "userId" : "..."
  }
} ]
                
              

DELETE /models/{id}

Removes 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}
Content-Type: */*

                
...
                
              
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}
Content-Type: */*
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" : { },
      "latest" : true
    },
    "rights" : "READ",
    "recipient" : {
      "userId" : "..."
    }
  }, {
    "id" : 12345,
    "created" : 12345,
    "model" : {
      "title" : "...",
      "created" : 12345,
      "id" : 12345,
      "createdBy" : { },
      "type" : { },
      "latest" : true
    },
    "rights" : "READ",
    "recipient" : {
      "userId" : "..."
    }
  } ],
  "ignoreTerms" : [ {
    "term" : "...",
    "id" : 12345,
    "source" : { }
  }, {
    "term" : "...",
    "id" : 12345,
    "source" : { }
  } ],
  "type" : "SYNCHRONIZED",
  "ignoreTermsDictionary" : { },
  "latest" : true
}
                
              

PUT /models/{id}

Updates the Model information, for example to change the name.

 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" : { },
      "latest" : true
    },
    "rights" : "READ",
    "recipient" : {
      "userId" : "..."
    }
  }, {
    "id" : 12345,
    "created" : 12345,
    "model" : {
      "title" : "...",
      "created" : 12345,
      "id" : 12345,
      "createdBy" : { },
      "type" : { },
      "latest" : true
    },
    "rights" : "READ_WRITE",
    "recipient" : {
      "userId" : "..."
    }
  } ],
  "ignoreTerms" : [ {
    "term" : "...",
    "id" : 12345,
    "source" : { }
  }, {
    "term" : "...",
    "id" : 12345,
    "source" : { }
  } ],
  "type" : "STANDARD",
  "ignoreTermsDictionary" : { },
  "latest" : true
}
                
              

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}
Content-Type: */*
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" : { },
    "latest" : true
  },
  "rights" : "READ",
  "recipient" : {
    "userId" : "..."
  }
}
                
              

GET /models/{id}/versions

Return all ModelVersion that a model has

 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
Content-Type: */*
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
Content-Type: */*

                
...
                
              
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
Content-Type: */*

                
...
                
              
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}
Content-Type: */*

                
...
                
              
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}
Content-Type: */*

                
...
                
              
Response
HTTP/1.1 204 No Content

              

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

Return a Model for the given modelId and version.

 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}
Content-Type: */*
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_WRITE",
    "created" : 12345,
    "user" : {
      "userId" : "..."
    }
  } ],
  "createdBy" : {
    "userId" : "..."
  },
  "invitations" : [ {
    "id" : 12345,
    "created" : 12345,
    "model" : {
      "title" : "...",
      "created" : 12345,
      "id" : 12345,
      "createdBy" : { },
      "type" : { },
      "latest" : true
    },
    "rights" : "READ_WRITE",
    "recipient" : {
      "userId" : "..."
    }
  }, {
    "id" : 12345,
    "created" : 12345,
    "model" : {
      "title" : "...",
      "created" : 12345,
      "id" : 12345,
      "createdBy" : { },
      "type" : { },
      "latest" : true
    },
    "rights" : "READ_WRITE",
    "recipient" : {
      "userId" : "..."
    }
  } ],
  "ignoreTerms" : [ {
    "term" : "...",
    "id" : 12345,
    "source" : { }
  }, {
    "term" : "...",
    "id" : 12345,
    "source" : { }
  } ],
  "type" : "MANAGED",
  "ignoreTermsDictionary" : { },
  "latest" : true
}