patchChannel - kewalsk/My-OpenPeriscope GitHub Wiki
PATCH https://channels.pscp.tv/v1/channels/{cid}
The patchChannel service changes channel information such as name and the restriction. The channel must be accessible to the authorized user (user is one of members). CID is unique identification number of the channel and can be obtained from the list of channels.
Place | Name | Type | Description | Optional |
---|---|---|---|---|
@Header | Authorization | String | The authorization token got from authorizeToken | No |
@Path | CID | String | The unique identification number of the channel | No |
@Body | member_restricted | boolean | Make channel restricted (closed) or not | Yes |
@Body | name | String | The new name of the channel | Yes |
The HTTP response code on successful update is 200 OK and the body, according to the sources, should be the empty object {}
but in fact the server respond with the:
Name | Type | Description | Optional |
---|---|---|---|
Channel | PsChannel | The channel class | No |
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 access problem, i.e the channel is restricted and not owned by authorized user |
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 |
Sending request (set $token to the proper value first):
curl -X PATCH -H "Authorization: $token" -d '{"name":"my new renamed channel"}' https://channels.pscp.tv/v1/channels/1752882535103340571
Result:
{ "Channel": { "CID": "1752882535103340571", "Name": "my new renamed channel", "Description": "", "UniversalLocales": null, "NLive": 0, "Featured": false, "PublicTag": "", "Slug": "", "ThumbnailURLs": [ { "url": "https://channel-thumbnails-live.pscp.tv/1752882535103340571/1565515316-RHeVGFTjRefByagy-CvoCM55ugE%3D-128x128.png", "ssl_url": "https://channel-thumbnails-live.pscp.tv/1752882535103340571/1565515316-RHeVGFTjRefByagy-CvoCM55ugE%3D-128x128.png", "width": 128, "height": 128 }, { "url": "https://channel-thumbnails-live.pscp.tv/1752882535103340571/1565515316-RHeVGFTjRefByagy-CvoCM55ugE%3D-200x200.png", "ssl_url": "https://channel-thumbnails-live.pscp.tv/1752882535103340571/1565515316-RHeVGFTjRefByagy-CvoCM55ugE%3D-200x200.png", "width": 200, "height": 200 }, { "url": "https://channel-thumbnails-live.pscp.tv/1752882535103340571/1565515316-RHeVGFTjRefByagy-CvoCM55ugE%3D-400x400.png", "ssl_url": "https://channel-thumbnails-live.pscp.tv/1752882535103340571/1565515316-RHeVGFTjRefByagy-CvoCM55ugE%3D-400x400.png", "width": 400, "height": 400 } ], "CreatedAt": "2019-08-11T09:14:43.248684251Z", "LastActivity": "2019-08-11T09:17:41.940534178Z", "Type": 1, "OwnerId": "1r***", "NMember": 1, "FrozenAt": "0001-01-01T00:00:00Z" } }