createChannel - kewalsk/My-OpenPeriscope GitHub Wiki

Create channel

POST https://channels.pscp.tv/v1/channels/

The createChannel service adds a new channel. Please note the trailing slash at the end, different than in other services.

Request parameters

Place Name Type Description Optional
@Header Authorization String The authorization token got from authorizeToken No
@Body RestrictMembersManagement boolean The channel will be restricted, only creator can manage the members Yes
@Body Name String The name of channel No
@Body Type int The type of channel, must be 1 No

Please note that only the name of channel can be specified, the description which is present in public channels, is not accessible and therefore always set to empty string.

The type of channel is a number 0, 1 or 2 but the meaning of these codes is currently unknown and the only value that is accepted in createChannel service is 1.

Response

Name Type Description Optional
Channel PsChannel The channel class No

The HTTP response code on successful add is 201 Created. The response body gives back the information about the created channel. The creator user is automatically added as member, you have to call Add members to channel to add more members.

Error responses

HTTP Result HTTP Message Body message Description
400 Bad Request {"success":false,"msg":"Bad Request"} The request has some improper arguments, for example token is wrong
400 Bad Request The response http error 400 without body means usually wrong parameters, i.e. Type value is not 1
401 Unauthorized Token did not validate:token is expired The authorization token is expired - get the new one
401 Unauthorized Requires authorization header There is no Authorization header in request
401 Unauthorized Token did not validate:token contains an invalid number of segments The authorization token is wrong
405 Method Not Allowed Wrong HTTP method was used, different than POST

Example

Sending request (set $token to the proper value first):

curl -H "Authorization: $token" -H "Content-Type: application/json" -d '{"Name":"my test channel","Type":1}' https://channels.pscp.tv/v1/channels/

Result:

 {"Channel":{"CID":"5211389611402159131","Name":"my test channel","Description":"","UniversalLocales":null,"NLive":0,"Featured":false,"PublicTag":"","Slug":"","ThumbnailURLs":null,"CreatedAt":"2019-08-10T09:56:03.70390183Z","LastActivity":"2019-08-10T09:56:03.70390183Z","Type":1,"OwnerId":"***","NMember":0}}
⚠️ **GitHub.com Fallback** ⚠️