Inshapardaz REST API

Inshapardaz APIs are a way to consume inshapardaz data store. The basic aim this API to let any application access the processed entities stored in the application.

Service is a standard REST API using HATEAOS. The main entry point is the [entry] (entry) you can follow to get access to other resources.

API Key

Currently this api do not require any key but this can change in future.

Authorisation

API will expose only the links that can be allowed for the user in context. If no user context is provided a guest user is assumed.

Authentication

Getting Started

Standard request and response headers

Get Dictionaries

Retrieves all dictionaries available to user.

Request

reqheader Accept:
 An mime type specifying the desired format of response. Supported formats are application/json and application/xml.
reqheader Authorization:
 An OAuth2 token to authosrise user. No token needed if the call is made as guest user.

Response

Returns the list of all dictionaries available to user. Please review [Dictionary Resource](DictoanryResource) for details on the individual items in array.

Response Codes

code 200:Success

Create Dictionary

### Uri ` /api/dictionaries`

#### Request ` POST /api/dictionaries HTTP/1.1 Content-Type: application/json Authorization: OAuth2 ... `

``` javascript {

name : ‘dictionary name’, description : ‘dictionary description’, language : 34, isPublic : true

}

#### Response ` HTTP/1.1 201 CREATED Content-Type: application/json `

``` javascript {

id : 12, name : ‘dictionary name’, description : ‘dictionary description’, language : 34, isPublic : true, links : [{

href : ‘...’, rel : ‘self’
},{
href : ‘...’ rel : ‘update’
},{
href : ‘...’, rel : ‘delete’
}, {
href : ‘...’, rel : ‘create-word’
}, {
href : ‘...’, rel : ‘reference-types’

}]

}

  • If a dictioanry is created successfully, a object representing newly created dictionary is returned in response. Please review the [Dictioanry Resource](DictioanryResource) for detials on object.
  • By default all dictionaries are public unless specified.

### Error Responses ###

Case | Response Code | Error Code |

|——————————————————-|——————-|——————————-| | User not allowed to create dictioanry | 403 Forbidden | Unauthorised | | No name specified | 400 Bad Request | Invalid name | | Name not specified | 400 Bad Request | Name required | | Invalid language | 400 Bad Request | Invalid Language | | Posted data not correct format | 400 Bad Request | Invlaid data |

GET dictionary

Request

Request Parameters

Parameter Name | Data Type Description
id | number Id of dictionary to get

Response

Response Codes

200:Success
403:Unauthorised
404:Dictionary not found

Update Dictionary

#### Uri

/api/dictionaries/{dictionaryId}

#### Request

` PUT /api/dictionaries/{id} HTTP/1.1 Content-Type: application/json Authorization: OAuth2 ... `

``` javascript {

id : 12, name : ‘dictionary name’, description : ‘dictionary description’, language : 34, isPublic : true

}

##### Request Parameters

Parameter Name | Data Type | Description |

|—————-|————-|—————————| | id | number | Id of dictionary to update|

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

``` javascript {

id : 12, name : ‘dictionary name’, description : ‘dictionary description’, language : 34, isPublic : true

}

### Error Responses ###

Case | Response Code | Error Code |

|——————————————————-|——————-|——————————-| | User not allowed to update dictioanry | 403 Forbidden | Unauthorised | | No matching dictionary found | 404 Not Found | Dictionary Not Found | | Title missing | 400 Bad Request | Title required | | Language id not valid | 400 Bad Request | Invlaid language | | Posted data not correct format | 400 Bad Request | Invlaid data |

### Delete dictionary

#### Uri /api/dictionaries/{id}

#### Request

` DELETE /api/dictionaries/{id} HTTP/1.1 Content-Type: application/json Authorization: OAuth2 ... `

##### Request Parameters

Parameter Name | Data Type | Description |

|—————-|————-|—————————| | id | number | Id of dictionary to delete|

#### Response ` HTTP/1.1 204 NoContent Content-Type: application/json `

### Error Responses ###

Case | Response Code | Error Code |

|——————————————————-|——————-|——————————-| | User not allowed to delete dictioanry | 403 Forbidden | Unauthorised | | No matching dictionary found | 404 Not Found | Dictionary Not Found |

Delete Dictionary

#### Uri /api/dictionaries/{id}

#### Request

` DELETE /api/dictionaries/{id} HTTP/1.1 Content-Type: application/json Authorization: OAuth2 ... `

##### Request Parameters

Parameter Name | Data Type | Description |

|—————-|————-|—————————| | id | number | Id of dictionary to delete|

#### Response ` HTTP/1.1 204 NoContent Content-Type: application/json `

### Error Responses ###

Case | Response Code | Error Code |

|——————————————————-|——————-|——————————-| | User not allowed to delete dictioanry | 403 Forbidden | Unauthorised | | No matching dictionary found | 404 Not Found | Dictionary Not Found |

Dictionary

Entry

Meaning

Meaning Context

Relationship

Translation

Word Details