Getting Started Edit
Welcome to GoChat APIs.
The APIs document was designed for those interested in developing for our platform.
The APIs are still under development and will evolve.
You’ll succeed if you do this.
Here’s some useful information.
Something may not happen if you try to do this.
Something bad will happen if you do this.
Authentication Edit
You need to be authenticated for all API requests. You can generate an API key in your developer dashboard.
Add the API key to all the Request Header.
Nothing will work unless you include this API key
curl --location --request GET 'localhost:1213/v1/api' \
--header 'GoChat-Token: 433578ab-84c2-4e02-4656-de55a8097c9f'
var settings = {
"url": "localhost:1213/v1/api",
"method": "GET",
"timeout": 0,
"headers": {
"GoChat-Token": "433578ab-84c2-4e02-4656-de55a8097c9f"
},
};
$.ajax(settings).done(function (response) {
console.log(response);
});
Errors Edit
CODE | STATUS | DESCRIPTION |
---|---|---|
200 | OK | Success |
201 | Created | Created Successful |
400 | Bad Request | We could not process that action |
403 | Forbidden | We couldn’t authenticate you |
500 | Internal Server Error | Error occurred in the backend service |
All response and error feedback using the right JSON format ————>
{
"id": 1,
"uuid": "bb16ab21-6968-4182-4902-da0e04416619",
"name": "root",
"password": "fa585d89c851dd338a70dcf535aa",
"max_role": 4,
"created_at": "2021-09-12T17:36:30.4119796+08:00"
}
{
"error": "sql: no rows in result set"
}
/user Edit
Create user
Authorization API Key
KEY | VALUE | DESCRIPTION |
---|---|---|
GoChat-Token | 433578ab-84c2-4e02-4656-de55a8097c9f |
Body raw(json)
KEY | TYPE | REQUIRED | DESCRIPTION |
---|---|---|---|
name | string | user's name | |
max_role | int | user's role {4: root; 2: admin; 0: guest} | |
password | string | user's password |
The value of password field will be encrypted before storing.
{
"name": "root",
"max_role": 4,
"password": "12345678"
}
curl --location --request POST 'localhost:1213/v1/user' \
--header 'GoChat-Token: 433578ab-84c2-4e02-4656-de55a8097c9f' \
--header 'Content-Type: application/json' \
--data-raw '{
"name": "root",
"max_role": 4,
"password": "12345678"
}'
var settings = {
"url": "localhost:1213/v1/user",
"method": "POST",
"timeout": 0,
"headers": {
"GoChat-Token": "433578ab-84c2-4e02-4656-de55a8097c9f",
"Content-Type": "application/json"
},
"data": JSON.stringify({
"name": "root",
"max_role": 4,
"password": "12345678"
}),
};
$.ajax(settings).done(function (response) {
console.log(response);
});
{
"id": 1,
"uuid": "bb16ab21-6968-4182-4902-da0e04416619",
"name": "root",
"password": "12345678",
"max_role": 4,
"created_at": "2021-09-12T17:36:30.4119796+08:00"
}
{
"error": "UNIQUE constraint failed: USERS.NAME"
}
/user/:id Edit
Read user
Authorization API Key
KEY | VALUE | DESCRIPTION |
---|---|---|
GoChat-Token | 433578ab-84c2-4e02-4656-de55a8097c9f |
Path Variables
KEY | VALUE | REQUIRED | DESCRIPTION |
---|---|---|---|
id | ✔ | user's primary key |
curl --location --request GET 'localhost:1213/v1/user/:id' \
--header 'GoChat-Token: 433578ab-84c2-4e02-4656-de55a8097c9f'
var settings = {
"url": "localhost:1213/v1/user/:id",
"method": "GET",
"timeout": 0,
"headers": {
"GoChat-Token": "433578ab-84c2-4e02-4656-de55a8097c9f",
},
};
$.ajax(settings).done(function (response) {
console.log(response);
});
{
"id": 1,
"uuid": "bb16ab21-6968-4182-4902-da0e04416619",
"name": "root",
"password": "fa585d89c851dd338a70dcf535aa",
"max_role": 4,
"created_at": "2021-09-12T17:36:30.4119796+08:00"
}
{
"error": "sql: no rows in result set"
}
/user/:id Edit
update user
Authorization API Key
KEY | VALUE | DESCRIPTION |
---|---|---|
GoChat-Token | 433578ab-84c2-4e02-4656-de55a8097c9f |
Path Variables
KEY | VALUE | REQUIRED | DESCRIPTION |
---|---|---|---|
id | ✔ | user's primary key |
Body raw(json)
KEY | TYPE | REQUIRED | DESCRIPTION |
---|---|---|---|
name | string | user's name | |
max_role | int | user's role {4: root; 2: admin; 0: guest} | |
password | string | user's password |
Only the fields appearing in the body will be updated.
{
"max_role": 2
}
curl --location --request PUT 'localhost:1213/v1/user/:id' \
--header 'GoChat-Token: 433578ab-84c2-4e02-4656-de55a8097c9f' \
--header 'Content-Type: application/json' \
--data-raw '{
"max_role": 2
}'
var settings = {
"url": "localhost:1213/v1/user/:id",
"method": "PUT",
"timeout": 0,
"headers": {
"GoChat-Token": "433578ab-84c2-4e02-4656-de55a8097c9f",
"Content-Type": "application/json"
},
"data": JSON.stringify({
"max_role": 2
}),
};
$.ajax(settings).done(function (response) {
console.log(response);
});
{
"id": 1,
"uuid": "bb16ab21-6968-4182-4902-da0e04416619",
"name": "root",
"password": "fa585d89c851dd338a70dcf535aa",
"max_role": 2,
"created_at": "2021-09-12T17:36:30.4119796+08:00"
}
{
"error": "sql: no rows in result set"
}
/user/:id Edit
Delete user
Authorization API Key
KEY | VALUE | DESCRIPTION |
---|---|---|
GoChat-Token | 433578ab-84c2-4e02-4656-de55a8097c9f |
Path Variables
KEY | VALUE | REQUIRED | DESCRIPTION |
---|---|---|---|
id | ✔ | user's primary key |
curl --location --request DELETE 'localhost:1213/v1/user/:id' \
--header 'GoChat-Token: 433578ab-84c2-4e02-4656-de55a8097c9f'
var settings = {
"url": "localhost:1213/v1/user/:id",
"method": "DELETE",
"timeout": 0,
"headers": {
"GoChat-Token": "433578ab-84c2-4e02-4656-de55a8097c9f",
},
};
$.ajax(settings).done(function (response) {
console.log(response);
});
{
"id": 1,
"uuid": "bb16ab21-6968-4182-4902-da0e04416619",
"name": "root",
"password": "fa585d89c851dd338a70dcf535aa",
"max_role": 4,
"created_at": "2021-09-12T17:36:30.4119796+08:00"
}
{
"error": "sql: no rows in result set"
}
/user Edit
Query user
Authorization API Key
KEY | VALUE | DESCRIPTION |
---|---|---|
GoChat-Token | 433578ab-84c2-4e02-4656-de55a8097c9f |
Request Params
KEY | VALUE | REQUIRED | DESCRIPTION |
---|---|---|---|
limit | max number of querying users | ||
id | user's primary key | ||
uuid | user's uuid | ||
name | user's name |
The priority order of parameter matching is: limit > id > uuid > name .
If the limit parameter is matched, return limited users.
If no parameter is matched, querying all users.
curl --location --request GET 'localhost:1213/v1/user?limit=&id=&uuid=&name=' \
--header 'GoChat-Token: 433578ab-84c2-4e02-4656-de55a8097c9f'
var settings = {
"url": "localhost:1213/v1/user?limit=&id=&uuid=&name=",
"method": "GET",
"timeout": 0,
"headers": {
"GoChat-Token": "433578ab-84c2-4e02-4656-de55a8097c9f"
},
};
$.ajax(settings).done(function (response) {
console.log(response);
});
{
"id": 1,
"uuid": "bb16ab21-6968-4182-4902-da0e04416619",
"name": "root",
"password": "fa585d89c851dd338a70dcf535aa",
"max_role": 4,
"created_at": "2021-09-12T17:36:30.4119796+08:00"
}
[
{
"id": 1,
"uuid": "bb16ab21-6968-4182-4902-da0e04416619",
"name": "root",
"password": "fa585d89c851dd338a70dcf535aa",
"max_role": 2,
"created_at": "2021-09-12T17:36:30.4119796+08:00"
},
{
"id": 2,
"uuid": "8b2af8ed-5b97-4abb-79b3-21a9d176a65e",
"name": "admin",
"password": "fa585d89c851dd338a70dcf535aa",
"max_role": 2,
"created_at": "2021-09-12T18:00:42.672102063+08:00"
}
]
{
"error": "sql: no rows in result set"
}
/user_session Edit
Query user's session
Authorization API Key
KEY | VALUE | DESCRIPTION |
---|---|---|
GoChat-Token | 433578ab-84c2-4e02-4656-de55a8097c9f |
Request Params
KEY | VALUE | REQUIRED | DESCRIPTION |
---|---|---|---|
id | user's primary key | ||
uuid | user's uuid | ||
name | user's name |
The priority order of parameter matching is: id > uuid > name .
If no parameter is matched, error querying.
curl --location --request GET 'localhost:1213/v1/user_sessions?id=&uuid=&name=' \
--header 'GoChat-Token: 433578ab-84c2-4e02-4656-de55a8097c9f'
var settings = {
"url": "localhost:1213/v1/user_sessions?id=&uuid=&name=",
"method": "GET",
"timeout": 0,
"headers": {
"GoChat-Token": "433578ab-84c2-4e02-4656-de55a8097c9f"
},
};
$.ajax(settings).done(function (response) {
console.log(response);
});
{
"id": 1,
"uuid": "1c8b135f-81d0-4cc6-643b-35a157cd6544",
"user_id": 1,
"created_at": "2021-09-12T18:13:25.770955738+08:00"
}
{
"error": "sql: no rows in result set"
}
/user_joined_groups Edit
Query user joined groups
Authorization API Key
KEY | VALUE | DESCRIPTION |
---|---|---|
GoChat-Token | 433578ab-84c2-4e02-4656-de55a8097c9f |
Request Params
KEY | VALUE | REQUIRED | DESCRIPTION |
---|---|---|---|
id | user's primary key | ||
uuid | user's uuid | ||
name | user's name |
The priority order of parameter matching is: id > uuid > name .
If no parameter is matched, error querying.
curl --location --request GET 'localhost:1213/v1/user_joined_groups?id=&uuid=&name=' \
--header 'GoChat-Token: 433578ab-84c2-4e02-4656-de55a8097c9f'
var settings = {
"url": "localhost:1213/v1/user_joined_groups?id=&uuid=&name=",
"method": "GET",
"timeout": 0,
"headers": {
"GoChat-Token": "433578ab-84c2-4e02-4656-de55a8097c9f"
},
};
$.ajax(settings).done(function (response) {
console.log(response);
});
[
{
"id": 1,
"uuid": "8f9d3c61-4b16-43b2-5e64-8ee10e98692e",
"name": "group_1",
"admin_id": 1,
"token": "4691fgcg15",
"created_at": "2021-09-12T18:14:21Z"
},
{
"id": 2,
"uuid": "06fc401e-6b7c-4c6f-4288-e7a518bc02d8",
"name": "group_2",
"admin_id": 2,
"token": "8hfg98893",
"created_at": "2021-09-12T18:14:33Z"
},
{
"id": 3,
"uuid": "85889538-16dc-4559-4143-e6352e2b5884",
"name": "group_3",
"admin_id": 2,
"token": "v34yb35vwt2",
"created_at": "2021-09-12T18:15:00Z"
},
{
"id": 5,
"uuid": "cb7c88cd-025a-449d-7b4c-848330dcb471",
"name": "group_5",
"admin_id": 1,
"token": "298fbgv479bv",
"created_at": "2021-09-12T18:15:55Z"
}
]
{
"error": "strconv.ParseInt: parsing \"a\": invalid syntax"
}
/user_created_groups Edit
Query user created groups
Authorization API Key
KEY | VALUE | DESCRIPTION |
---|---|---|
GoChat-Token | 433578ab-84c2-4e02-4656-de55a8097c9f |
Request Params
KEY | VALUE | REQUIRED | DESCRIPTION |
---|---|---|---|
id | user's primary key | ||
uuid | user's uuid | ||
name | user's name |
The priority order of parameter matching is: id > uuid > name .
If no parameter is matched, error querying.
curl --location --request GET 'localhost:1213/v1/user_created_groups?id=&uuid=&name=' \
--header 'GoChat-Token: 433578ab-84c2-4e02-4656-de55a8097c9f'
var settings = {
"url": "localhost:1213/v1/user_created_groups?id=&uuid=&name=",
"method": "GET",
"timeout": 0,
"headers": {
"GoChat-Token": "433578ab-84c2-4e02-4656-de55a8097c9f"
},
};
$.ajax(settings).done(function (response) {
console.log(response);
});
[
{
"id": 1,
"uuid": "8f9d3c61-4b16-43b2-5e64-8ee10e98692e",
"name": "group_1",
"admin_id": 1,
"token": "4691fgcg15",
"created_at": "2021-09-12T18:14:21Z"
},
{
"id": 5,
"uuid": "cb7c88cd-025a-449d-7b4c-848330dcb471",
"name": "group_5",
"admin_id": 1,
"token": "298fbgv479bv",
"created_at": "2021-09-12T18:15:55Z"
}
]
{
"error": "strconv.ParseInt: parsing \"a\": invalid syntax"
}
/session Edit
Create session
Authorization API Key
KEY | VALUE | DESCRIPTION |
---|---|---|
GoChat-Token | 433578ab-84c2-4e02-4656-de55a8097c9f |
Body raw(json)
KEY | TYPE | REQUIRED | DESCRIPTION |
---|---|---|---|
user_id | int | user's primary key |
{
"user_id": 1
}
curl --location --request POST 'localhost:1213/v1/session' \
--header 'GoChat-Token: 433578ab-84c2-4e02-4656-de55a8097c9f' \
--header 'Content-Type: application/json' \
--data-raw '{
"user_id": 1
}'
var settings = {
"url": "localhost:1213/v1/session",
"method": "POST",
"timeout": 0,
"headers": {
"GoChat-Token": "433578ab-84c2-4e02-4656-de55a8097c9f",
"Content-Type": "application/json"
},
"data": JSON.stringify({
"user_id": 1
}),
};
$.ajax(settings).done(function (response) {
console.log(response);
});
{
"id": 1,
"uuid": "6148a98d-59d8-445a-6779-120c25c3eb06",
"user_id": 1,
"created_at": "2021-09-12T18:56:52.265261668+08:00"
}
{
"error": "FOREIGN KEY constraint failed"
}
/session/:id Edit
Read session
Authorization API Key
KEY | VALUE | DESCRIPTION |
---|---|---|
GoChat-Token | 433578ab-84c2-4e02-4656-de55a8097c9f |
Path Variables
KEY | VALUE | REQUIRED | DESCRIPTION |
---|---|---|---|
id | ✔ | primary key of session |
curl --location --request GET 'localhost:1213/v1/session/:id' \
--header 'GoChat-Token: 433578ab-84c2-4e02-4656-de55a8097c9f'
var settings = {
"url": "localhost:1213/v1/session/:id",
"method": "GET",
"timeout": 0,
"headers": {
"GoChat-Token": "433578ab-84c2-4e02-4656-de55a8097c9f"
},
};
$.ajax(settings).done(function (response) {
console.log(response);
});
{
"id": 1,
"uuid": "1c8b135f-81d0-4cc6-643b-35a157cd6544",
"user_id": 1,
"created_at": "2021-09-12T18:13:25.770955738+08:00"
}
{
"error": "sql: no rows in result set"
}
/session/:id Edit
Delete session
Authorization API Key
KEY | VALUE | DESCRIPTION |
---|---|---|
GoChat-Token | 433578ab-84c2-4e02-4656-de55a8097c9f |
Path Variables
KEY | VALUE | REQUIRED | DESCRIPTION |
---|---|---|---|
id | ✔ | primary key of session |
curl --location --request DELETE 'localhost:1213/v1/session/:id' \
--header 'GoChat-Token: 433578ab-84c2-4e02-4656-de55a8097c9f'
var settings = {
"url": "localhost:1213/v1/session/:id",
"method": "DELETE",
"timeout": 0,
"headers": {
"GoChat-Token": "433578ab-84c2-4e02-4656-de55a8097c9f"
},
};
$.ajax(settings).done(function (response) {
console.log(response);
});
{
"id": 1,
"uuid": "1c8b135f-81d0-4cc6-643b-35a157cd6544",
"user_id": 1,
"created_at": "2021-09-12T18:13:25.770955738+08:00"
}
{
"error": "sql: no rows in result set"
}
/session Edit
Query session
Authorization API Key
KEY | VALUE | DESCRIPTION |
---|---|---|
GoChat-Token | 433578ab-84c2-4e02-4656-de55a8097c9f |
Request Params
KEY | VALUE | REQUIRED | DESCRIPTION |
---|---|---|---|
id | primary key of session | ||
uuid | uuid of session | ||
user_id | user's primary key |
If no parameter is matched, error querying.
curl --location --request GET 'localhost:1213/v1/session?limit=&id=1&uuid=&user_id=' \
--header 'GoChat-Token: 433578ab-84c2-4e02-4656-de55a8097c9f'
var settings = {
"url": "localhost:1213/v1/session?limit=&id=1&uuid=&user_id=",
"method": "GET",
"timeout": 0,
"headers": {
"GoChat-Token": "433578ab-84c2-4e02-4656-de55a8097c9f"
},
};
$.ajax(settings).done(function (response) {
console.log(response);
});
{
"id": 7,
"uuid": "6148a98d-59d8-445a-6779-120c25c3eb06",
"user_id": 1,
"created_at": "2021-09-12T18:56:52.265261668+08:00"
}
{
"error": "sql: no rows in result set"
}
/session_user Edit
Query session
Authorization API Key
KEY | VALUE | DESCRIPTION |
---|---|---|
GoChat-Token | 433578ab-84c2-4e02-4656-de55a8097c9f |
Request Params
KEY | VALUE | REQUIRED | DESCRIPTION |
---|---|---|---|
id | primary key of session | ||
uuid | uuid of session | ||
user_id | user's primary key |
If no parameter is matched, error querying.
curl --location --request GET 'localhost:1213/v1/session_user?id=&uuid=&user_id=' \
--header 'GoChat-Token: 433578ab-84c2-4e02-4656-de55a8097c9f'
var settings = {
"url": "localhost:1213/v1/session_user?id=&uuid=&user_id=",
"method": "GET",
"timeout": 0,
"headers": {
"GoChat-Token": "433578ab-84c2-4e02-4656-de55a8097c9f"
},
};
$.ajax(settings).done(function (response) {
console.log(response);
});
{
"id": 1,
"uuid": "bb16ab21-6968-4182-4902-da0e04416619",
"name": "root",
"password": "fa585d89c851dd338a70dcf535aa",
"max_role": 2,
"created_at": "2021-09-12T17:36:30.4119796+08:00"
}
{
"error": "sql: no rows in result set"
}
/group Edit
Create group
Authorization API Key
KEY | VALUE | DESCRIPTION |
---|---|---|
GoChat-Token | 433578ab-84c2-4e02-4656-de55a8097c9f |
Body raw(json)
KEY | TYPE | REQUIRED | DESCRIPTION |
---|---|---|---|
name | string | name of group | |
token | string | token of group | |
admin_id | string | primary key of administrator of group |
If the value of token field, error creating.
{
"name": "group_1",
"token": "298fbgv479bv",
"admin_id": 1
}
curl --location --request POST 'localhost:1213/v1/group' \
--header 'GoChat-Token: 433578ab-84c2-4e02-4656-de55a8097c9f' \
--header 'Content-Type: application/json' \
--data-raw '{
"name": "group_1",
"token": "298fbgv479bv",
"admin_id": 1
}'
var settings = {
"url": "localhost:1213/v1/group",
"method": "POST",
"timeout": 0,
"headers": {
"GoChat-Token": "433578ab-84c2-4e02-4656-de55a8097c9f",
"Content-Type": "application/json"
},
"data": JSON.stringify({
"name": "group_1",
"token": "298fbgv479bv",
"admin_id": 1
}),
};
$.ajax(settings).done(function (response) {
console.log(response);
});
{
"id": 1,
"uuid": "19aa6eeb-22e4-4ad9-728c-fa739598e71e",
"name": "group_1",
"admin_id": 1,
"token": "298fbgv479bv",
"created_at": "2021-09-14T11:33:50.363813918+08:00"
}
{
"error": "UNIQUE constraint failed: GROUPS.NAME"
}
/group/:id Edit
Read group
Authorization API Key
KEY | VALUE | DESCRIPTION |
---|---|---|
GoChat-Token | 433578ab-84c2-4e02-4656-de55a8097c9f |
Path Variables
KEY | VALUE | REQUIRED | DESCRIPTION |
---|---|---|---|
id | ✔ | primary key of group |
curl --location --request GET 'localhost:1213/v1/group/:id' \
--header 'GoChat-Token: 433578ab-84c2-4e02-4656-de55a8097c9f'
var settings = {
"url": "localhost:1213/v1/group/:id",
"method": "GET",
"timeout": 0,
"headers": {
"GoChat-Token": "433578ab-84c2-4e02-4656-de55a8097c9f"
},
};
$.ajax(settings).done(function (response) {
console.log(response);
});
{
"id": 1,
"uuid": "19aa6eeb-22e4-4ad9-728c-fa739598e71e",
"name": "group_1",
"admin_id": 1,
"token": "298fbgv479bv",
"created_at": "2021-09-14T11:33:50Z"
}
{
"error": "sql: no rows in result set"
}
/group/:id Edit
Update group
Authorization API Key
KEY | VALUE | DESCRIPTION |
---|---|---|
GoChat-Token | 433578ab-84c2-4e02-4656-de55a8097c9f |
Path Variables
KEY | VALUE | REQUIRED | DESCRIPTION |
---|---|---|---|
id | ✔ | primary key of group |
Body raw(json)
KEY | TYPE | REQUIRED | DESCRIPTION |
---|---|---|---|
name | string | name of group | |
token | string | token of group | |
admin_id | string | primary key of administrator of group |
Only the fields appearing in the body will be updated.
{
"admin_id": 1
}
curl --location --request PUT 'localhost:1213/v1/group/:id' \
--header 'GoChat-Token: 433578ab-84c2-4e02-4656-de55a8097c9f' \
--header 'Content-Type: application/json' \
--data-raw '{
"admin_id": "1"
}'
var settings = {
"url": "localhost:1213/v1/group/:id",
"method": "PUT",
"timeout": 0,
"headers": {
"GoChat-Token": "433578ab-84c2-4e02-4656-de55a8097c9f",
"Content-Type": "application/json"
},
"data": JSON.stringify({
"admin_id": "1"
}),
};
$.ajax(settings).done(function (response) {
console.log(response);
});
{
"id": 2,
"uuid": "7f755179-8ce9-489a-701d-d25c0fc25fd4",
"name": "group_2",
"admin_id": 1,
"token": "nckjwbh398hc3",
"created_at": "2021-09-14T11:41:56Z"
}
{
"error": "json: cannot unmarshal string into Go struct field Group.admin_id of type int"
}
/group/:id Edit
Delete group
Authorization API Key
KEY | VALUE | DESCRIPTION |
---|---|---|
GoChat-Token | 433578ab-84c2-4e02-4656-de55a8097c9f |
Path Variables
KEY | VALUE | REQUIRED | DESCRIPTION |
---|---|---|---|
id | ✔ | primary key of group |
curl --location --request DELETE 'localhost:1213/v1/group/:id' \
--header 'GoChat-Token: 433578ab-84c2-4e02-4656-de55a8097c9f'
var settings = {
"url": "localhost:1213/v1/group/:id",
"method": "DELETE",
"timeout": 0,
"headers": {
"GoChat-Token": "433578ab-84c2-4e02-4656-de55a8097c9f",
},
};
$.ajax(settings).done(function (response) {
console.log(response);
});
{
"id": 2,
"uuid": "7f755179-8ce9-489a-701d-d25c0fc25fd4",
"name": "group_2",
"admin_id": 2,
"token": "nckjwbh398hc3",
"created_at": "2021-09-14T11:41:56Z"
}
{
"error": "sql: no rows in result set"
}
/group Edit
Query group
Authorization API Key
KEY | VALUE | DESCRIPTION |
---|---|---|
GoChat-Token | 433578ab-84c2-4e02-4656-de55a8097c9f |
Request Params
KEY | VALUE | REQUIRED | DESCRIPTION |
---|---|---|---|
limit | max number of querying groups | ||
id | primary key of group | ||
uuid | uuid of group | ||
name | name of group |
The priority order of parameter matching is: limit > id > uuid > name .
If the limit parameter is matched, return limited groups.
If no parameter is matched, querying all groups.
curl --location --request GET 'localhost:1213/v1/group?limit=&id=&uuid=&name=' \
--header 'GoChat-Token: 433578ab-84c2-4e02-4656-de55a8097c9f'
var settings = {
"url": "localhost:1213/v1/group?limit=&id=&uuid=&name=",
"method": "GET",
"timeout": 0,
"headers": {
"GoChat-Token": "433578ab-84c2-4e02-4656-de55a8097c9f"
},
};
$.ajax(settings).done(function (response) {
console.log(response);
});
{
"id": 1,
"uuid": "19aa6eeb-22e4-4ad9-728c-fa739598e71e",
"name": "group_1",
"admin_id": 1,
"token": "298fbgv479bv",
"created_at": "2021-09-14T11:33:50Z"
}
[
{
"id": 1,
"uuid": "19aa6eeb-22e4-4ad9-728c-fa739598e71e",
"name": "group_1",
"admin_id": 1,
"token": "298fbgv479bv",
"created_at": "2021-09-14T11:33:50Z"
},
{
"id": 2,
"uuid": "7f755179-8ce9-489a-701d-d25c0fc25fd4",
"name": "group_2",
"admin_id": 2,
"token": "nckjwbh398hc3",
"created_at": "2021-09-14T11:41:56Z"
}
]
{
"error": "sql: no rows in result set"
}
/group_members Edit
Query members of group
Authorization API Key
KEY | VALUE | DESCRIPTION |
---|---|---|
GoChat-Token | 433578ab-84c2-4e02-4656-de55a8097c9f |
Request Params
KEY | VALUE | REQUIRED | DESCRIPTION |
---|---|---|---|
id | primary key of group | ||
uuid | uuid of group | ||
name | name of group |
The priority order of parameter matching is: id > uuid > name .
If no parameter is matched, error querying.
curl --location --request GET 'localhost:1213/v1/group_members?id=&uuid=&name=' \
--header 'GoChat-Token: 433578ab-84c2-4e02-4656-de55a8097c9f'
var settings = {
"url": "localhost:1213/v1/group_members?id=&uuid=&name=",
"method": "GET",
"timeout": 0,
"headers": {
"GoChat-Token": "433578ab-84c2-4e02-4656-de55a8097c9f"
},
};
$.ajax(settings).done(function (response) {
console.log(response);
});
[
{
"id": 1,
"uuid": "bb16ab21-6968-4182-4902-da0e04416619",
"name": "root",
"password": "fa585d89c851dd338a70dcf535aa",
"max_role": 2,
"created_at": "2021-09-12T17:36:30.4119796+08:00"
},
{
"id": 2,
"uuid": "8b2af8ed-5b97-4abb-79b3-21a9d176a65e",
"name": "admin",
"password": "fa585d89c851dd338a70dcf535aa",
"max_role": 2,
"created_at": "2021-09-12T18:00:42.672102063+08:00"
}
]
{
"error": "sql: no rows in result set"
}
/group_administrator Edit
Query administrator of group
Authorization API Key
KEY | VALUE | DESCRIPTION |
---|---|---|
GoChat-Token | 433578ab-84c2-4e02-4656-de55a8097c9f |
Request Params
KEY | VALUE | REQUIRED | DESCRIPTION |
---|---|---|---|
id | primary key of group | ||
uuid | uuid of group | ||
name | name of group |
The priority order of parameter matching is: id > uuid > name .
If no parameter is matched, error querying.
curl --location --request GET 'localhost:1213/v1/group_administrator?id=&uuid=&name=' \
--header 'GoChat-Token: 433578ab-84c2-4e02-4656-de55a8097c9f'
var settings = {
"url": "localhost:1213/v1/group_administrator?id=&uuid=&name=",
"method": "GET",
"timeout": 0,
"headers": {
"GoChat-Token": "433578ab-84c2-4e02-4656-de55a8097c9f"
},
};
$.ajax(settings).done(function (response) {
console.log(response);
});
{
"id": 1,
"uuid": "c30614b6-d67b-4d96-76c0-4cfe330530cb",
"name": "root",
"password": "fa585d89c851dd338a70dcf535aa2a92f",
"max_role": 1,
"created_at": "2021-09-14T11:33:12.550735663+08:00"
}
{
"error": "strconv.ParseInt: parsing \"a\": invalid syntax"
}
/member Edit
Create member
Authorization API Key
KEY | VALUE | DESCRIPTION |
---|---|---|
GoChat-Token | 433578ab-84c2-4e02-4656-de55a8097c9f |
Body raw(json)
KEY | TYPE | REQUIRED | DESCRIPTION |
---|---|---|---|
group_id | int | primary key of group | |
user_id | int | primary key of user |
{
"group_id": 1,
"user_id": 10
}
curl --location --request POST 'localhost:1213/v1/member' \
--header 'GoChat-Token: 433578ab-84c2-4e02-4656-de55a8097c9f' \
--header 'Content-Type: application/json' \
--data-raw '{
"group_id": 1,
"user_id": 1
}'
var settings = {
"url": "localhost:1213/v1/member",
"method": "POST",
"timeout": 0,
"headers": {
"GoChat-Token": "433578ab-84c2-4e02-4656-de55a8097c9f",
"Content-Type": "application/json"
},
"data": JSON.stringify({
"group_id": 1,
"user_id": 1
}),
};
$.ajax(settings).done(function (response) {
console.log(response);
});
{
"error": "FOREIGN KEY constraint failed"
}
/member/:group_id/:user_id Edit
Delete user
Authorization API Key
KEY | VALUE | DESCRIPTION |
---|---|---|
GoChat-Token | 433578ab-84c2-4e02-4656-de55a8097c9f |
Path Variables
KEY | VALUE | REQUIRED | DESCRIPTION |
---|---|---|---|
group_id | ✔ | primary key of group | |
user_id | ✔ | primary key of user |
curl --location --request DELETE 'localhost:1213/v1/user/:group_id/:user_id' \
--header 'GoChat-Token: 433578ab-84c2-4e02-4656-de55a8097c9f'
var settings = {
"url": "localhost:1213/v1/user/:group_id/:user_id",
"method": "DELETE",
"timeout": 0,
"headers": {
"GoChat-Token": "433578ab-84c2-4e02-4656-de55a8097c9f",
},
};
$.ajax(settings).done(function (response) {
console.log(response);
});