GET /api/v2/message-groups
List the account's message groups

Examples

GET /api/v2/message-groups
200
{
  "data": [],
  "meta": {
    "total-pages": 1,
    "record-count": 0
  },
  "links": {
    "first": "http://test.host/api/v2/message-groups?page%5Bnumber%5D=1&page%5Bsize%5D=10",
    "last": "http://test.host/api/v2/message-groups?page%5Bnumber%5D=1&page%5Bsize%5D=10"
  }
}

GET /api/v2/message-groups/:id
Show a message group

Examples

GET /api/v2/message-groups/47
200
{
  "data": {
    "id": "47",
    "type": "message-groups",
    "links": {
      "self": "http://test.host/api/v2/message-groups/47"
    },
    "attributes": {
      "group-chat": false,
      "chat-room-name": null,
      "updated-at": "2017-08-29T10:51:35.703+08:00",
      "has-unread-message": false
    },
    "relationships": {
      "last-message": {
        "links": {
          "self": "http://test.host/api/v2/message-groups/47/relationships/last-message",
          "related": "http://test.host/api/v2/message-groups/47/last-message"
        }
      },
      "accounts": {
        "links": {
          "self": "http://test.host/api/v2/message-groups/47/relationships/accounts",
          "related": "http://test.host/api/v2/message-groups/47/accounts"
        }
      },
      "messages": {
        "links": {
          "self": "http://test.host/api/v2/message-groups/47/relationships/messages",
          "related": "http://test.host/api/v2/message-groups/47/messages"
        }
      }
    }
  }
}

Params

Param name Description
id
required

Message group ID

Validations:

  • Must be an identifier, string from 1 to 128 characters containing only alphanumeric characters, space, underscore(_), hyphen(-) with no leading or trailing space.


POST /api/v2/message-groups
Create a message group

Examples

POST /api/v2/message-groups
{
  "data": {
    "type": "message-groups",
    "attributes": {
      "group-chat": false,
      "chat-room-name": null,
      "updated-at": null,
      "has-unread-message": false
    },
    "relationships": {
      "accounts": {
        "data": [
          {
            "type": "accounts",
            "id": "1335"
          },
          {
            "type": "accounts",
            "id": "1336"
          }
        ]
      }
    }
  }
}
201
{
  "data": {
    "id": "2",
    "type": "message-groups",
    "links": {
      "self": "http://test.host/api/v2/message-groups/2"
    },
    "attributes": {
      "group-chat": false,
      "chat-room-name": null,
      "updated-at": "2017-08-29T10:51:06.760+08:00",
      "has-unread-message": false
    },
    "relationships": {
      "last-message": {
        "links": {
          "self": "http://test.host/api/v2/message-groups/2/relationships/last-message",
          "related": "http://test.host/api/v2/message-groups/2/last-message"
        }
      },
      "accounts": {
        "links": {
          "self": "http://test.host/api/v2/message-groups/2/relationships/accounts",
          "related": "http://test.host/api/v2/message-groups/2/accounts"
        }
      },
      "messages": {
        "links": {
          "self": "http://test.host/api/v2/message-groups/2/relationships/messages",
          "related": "http://test.host/api/v2/message-groups/2/messages"
        }
      }
    }
  }
}

Params

Param name Description
data
required

Message Group Information

Validations:

  • Must be a Hash

data[type]
required

Validations:

data[relationships]
required

Validations:

  • Must be a Hash

data[relationships][accounts]
required

Validations:

  • Must be a Hash

data[relationships][accounts][data]
required

Validations:

  • Must be an Array of nested elements

data[relationships][accounts][data][type]
required

Account type, which is `accounts`

Validations:

  • Must be a String

data[relationships][accounts][data][id]
required

Account ID

Validations:

  • Must be an identifier, string from 1 to 128 characters containing only alphanumeric characters, space, underscore(_), hyphen(-) with no leading or trailing space.


PATCH /api/v2/message-groups/:id
Update a message group

Examples

PATCH /api/v2/message-groups/44
{
  "data": {
    "id": "44",
    "type": "message-groups",
    "attributes": {
      "group-chat": true,
      "chat-room-name": "New Room Name",
      "updated-at": "2017-08-29 10:51:33 +0800",
      "has-unread-message": false
    },
    "relationships": {}
  }
}
200
{
  "data": {
    "id": "44",
    "type": "message-groups",
    "links": {
      "self": "http://test.host/api/v2/message-groups/44"
    },
    "attributes": {
      "group-chat": true,
      "chat-room-name": "New Room Name",
      "updated-at": "2017-08-29T10:51:33.000+08:00",
      "has-unread-message": false
    },
    "relationships": {
      "last-message": {
        "links": {
          "self": "http://test.host/api/v2/message-groups/44/relationships/last-message",
          "related": "http://test.host/api/v2/message-groups/44/last-message"
        }
      },
      "accounts": {
        "links": {
          "self": "http://test.host/api/v2/message-groups/44/relationships/accounts",
          "related": "http://test.host/api/v2/message-groups/44/accounts"
        }
      },
      "messages": {
        "links": {
          "self": "http://test.host/api/v2/message-groups/44/relationships/messages",
          "related": "http://test.host/api/v2/message-groups/44/messages"
        }
      }
    }
  }
}

Params

Param name Description
id
required

Message group ID

Validations:

  • Must be an identifier, string from 1 to 128 characters containing only alphanumeric characters, space, underscore(_), hyphen(-) with no leading or trailing space.

data
required

Message Group Information

Validations:

  • Must be a Hash

data[type]
optional

Validations:

data[relationships]
optional

Validations:

  • Must be a Hash

data[relationships][accounts]
optional

Validations:

  • Must be a Hash

data[relationships][accounts][data]
optional

Validations:

  • Must be an Array of nested elements

data[relationships][accounts][data][type]
optional

Account type, which is `accounts`

Validations:

  • Must be a String

data[relationships][accounts][data][id]
optional

Account ID

Validations:

  • Must be an identifier, string from 1 to 128 characters containing only alphanumeric characters, space, underscore(_), hyphen(-) with no leading or trailing space.


PATCH /api/v2/message-groups/:id/join
Join group chat

Examples

PATCH /api/v2/message-groups/25/add-participants
{
  "data": {
    "id": "25",
    "type": "message-groups",
    "attributes": {
      "group-chat": true,
      "chat-room-name": null,
      "updated-at": "2017-08-29 10:51:20 +0800",
      "has-unread-message": false
    },
    "relationships": {
      "accounts": {
        "data": [
          {
            "type": "accounts",
            "id": "1398"
          }
        ]
      }
    }
  }
}
200
{
  "data": {
    "id": "25",
    "type": "message-groups",
    "links": {
      "self": "/api/v2/message-groups/25"
    },
    "attributes": {
      "group-chat": true,
      "chat-room-name": null,
      "updated-at": "2017-08-29T10:51:20.989+08:00",
      "has-unread-message": false
    },
    "relationships": {
      "last-message": {
        "links": {
          "self": "/api/v2/message-groups/25/relationships/last-message",
          "related": "/api/v2/message-groups/25/last-message"
        }
      },
      "accounts": {
        "links": {
          "self": "/api/v2/message-groups/25/relationships/accounts",
          "related": "/api/v2/message-groups/25/accounts"
        }
      },
      "messages": {
        "links": {
          "self": "/api/v2/message-groups/25/relationships/messages",
          "related": "/api/v2/message-groups/25/messages"
        }
      }
    }
  }
}

PATCH /api/v2/message-groups/:id/leave
Leave group chat

Examples

PATCH /api/v2/message-groups/37/leave
{}
200
{
  "data": {
    "id": "37",
    "type": "message-groups",
    "links": {
      "self": "/api/v2/message-groups/37"
    },
    "attributes": {
      "group-chat": true,
      "chat-room-name": null,
      "updated-at": "2017-08-29T10:51:29.417+08:00",
      "has-unread-message": false
    },
    "relationships": {
      "last-message": {
        "links": {
          "self": "/api/v2/message-groups/37/relationships/last-message",
          "related": "/api/v2/message-groups/37/last-message"
        }
      },
      "accounts": {
        "links": {
          "self": "/api/v2/message-groups/37/relationships/accounts",
          "related": "/api/v2/message-groups/37/accounts"
        }
      },
      "messages": {
        "links": {
          "self": "/api/v2/message-groups/37/relationships/messages",
          "related": "/api/v2/message-groups/37/messages"
        }
      }
    }
  }
}