PolesApi Resource

GET /poles

For an authenticated user, this method retrieves the list of pole which the user can edit

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

Response Body
media type data type description
application/json PolesResponse (JSON) The poles which the user can edit

Example

Request
GET /poles
Accept: application/json

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

                
{
  "size" : 12345,
  "poles" : [ {
    "parts" : [ {
      "term" : "...",
      "weight" : 12345.0
    }, {
      "term" : "...",
      "weight" : 12345.0
    } ],
    "id" : 12345,
    "language" : "...",
    "description" : "...",
    "name" : "..."
  }, {
    "parts" : [ {
      "term" : "...",
      "weight" : 12345.0
    }, {
      "term" : "...",
      "weight" : 12345.0
    } ],
    "id" : 12345,
    "language" : "...",
    "description" : "...",
    "name" : "..."
  } ]
}
                
              

POST /poles

For an authenticated user, this method allows the user to create a pole

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

Request Body
media type data type description
application/json Pole (JSON) The pole to be created in json structure { "name":"POS EN", "description":"Positive ENGLISH", "language":"EN", "parts":[ { "term":"(*^^*)", "weight":1.0 } ]}
Response Body
media type data type description
application/json Pole (JSON) The created pole, with the id

Example

Request
POST /poles
Content-Type: application/json
Accept: application/json

                
{
  "name" : "...",
  "parts" : [ {
    "term" : "...",
    "weight" : 12345.0
  }, {
    "term" : "...",
    "weight" : 12345.0
  } ],
  "description" : "...",
  "language" : "..."
}
                
              
Response
HTTP/1.1 201 Created
Content-Type: application/json

                
{
  "parts" : [ {
    "term" : "...",
    "weight" : 12345.0
  }, {
    "term" : "...",
    "weight" : 12345.0
  } ],
  "id" : 12345,
  "language" : "...",
  "description" : "...",
  "name" : "..."
}
                
              

DELETE /poles/{id}

For an authenticated user, this method deletes a pole, if he has sufficient rights

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

Request Parameters
name type description constraints
id path The poleId which is to be deleted min: 1
Response Body
media type data type description
application/json Pole (JSON) The deleted pole

Example

Request
DELETE /poles/{id}
Accept: application/json

              
Response
HTTP/1.1 204 No Content
Content-Type: application/json

                
{
  "parts" : [ {
    "term" : "...",
    "weight" : 12345.0
  }, {
    "term" : "...",
    "weight" : 12345.0
  } ],
  "id" : 12345,
  "language" : "...",
  "description" : "...",
  "name" : "..."
}
                
              

GET /poles/{id}

For an authenticated user, this method retrieves the details of a pole specified by an id, if the user has access to it.

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

Request Parameters
name type description constraints
id path The id of the pole to retrieve min: 1
Response Body
media type data type description
application/json Pole (JSON) The requested pole

Example

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

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

                
{
  "parts" : [ {
    "term" : "...",
    "weight" : 12345.0
  }, {
    "term" : "...",
    "weight" : 12345.0
  } ],
  "id" : 12345,
  "language" : "...",
  "description" : "...",
  "name" : "..."
}
                
              

PUT /poles/{id}

For an authenticated user, this method allows the user to update a pole, if he has access to it

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

Request Parameters
name type description default constraints
id path The id of the pole to be updated   min: 1
clearContents query If this flag is set, the pole parts are cleared and are populated with the pole parts in the json payload. If it is not set, the pole parts in the payload are appended to the existing pole parts true boolean
Request Body
media type data type description
application/json Pole (JSON) The pole, in json structure { "name":"POS EN", "description":"Positive ENGLISH", "language":"EN", "parts":[ { "term":"(*^^*)", "weight":1.0 } ]}
Response Body
media type data type description
application/json Pole (JSON) The updated pole, with the id

Example

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

                
{
  "name" : "...",
  "parts" : [ {
    "term" : "...",
    "weight" : 12345.0
  }, {
    "term" : "...",
    "weight" : 12345.0
  } ],
  "description" : "...",
  "language" : "..."
}
                
              
Response
HTTP/1.1 204 No Content
Content-Type: application/json

                
{
  "parts" : [ {
    "term" : "...",
    "weight" : 12345.0
  }, {
    "term" : "...",
    "weight" : 12345.0
  } ],
  "id" : 12345,
  "language" : "...",
  "description" : "...",
  "name" : "..."
}
                
              

GET /poles/{id}/suggest

For an authenticated user, this method retrieves suggestions for a pole, if he has access to it

 https://api.gavagai.se/explorer/v1/poles/1/suggest
 

Request Parameters
name type description constraints
id path The poleId for which suggestions are required min: 1
Response Body
media type data type description
application/json PoleSuggestions (JSON) The suggestions with the pole itself

Example

Request
GET /poles/{id}/suggest
Accept: application/json

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

                
{
  "suggestions" : [ {
    "sumCosine" : 12345.0,
    "forWord" : "...",
    "term" : "...",
    "stringSimilarity" : true,
    "cosine" : 12345.0,
    "frequency" : 12345,
    "neighbourCounter" : 12345,
    "reciprocal" : true
  }, {
    "sumCosine" : 12345.0,
    "forWord" : "...",
    "term" : "...",
    "stringSimilarity" : true,
    "cosine" : 12345.0,
    "frequency" : 12345,
    "neighbourCounter" : 12345,
    "reciprocal" : true
  } ],
  "pole" : {
    "parts" : [ {
      "term" : "...",
      "weight" : 12345.0
    }, {
      "term" : "...",
      "weight" : 12345.0
    } ],
    "id" : 12345,
    "language" : "...",
    "description" : "...",
    "name" : "..."
  }
}