DDVTECH / mistserver

The official mistserver source repository - www.mistserver.com
The Unlicense
378 stars 129 forks source link

API requests #193

Closed MapGuy11 closed 6 months ago

MapGuy11 commented 6 months ago

Hey all,

We use Mist Server for our community Discord server driven live streams. One feature I would love to implement is a panel for our participants to control their stream RTMP pushes. The main issue is where is the documentation to use curl or some kind of API to set a new push URL to a stream. I haven't been able to find this anywhere and I was wondering if someone can guide me to some piece of documentation or even better an example of the URL!

Thank you all for your time!

Rokamun commented 6 months ago

Hey there,

The API documentation can be found here: https://docs.mistserver.org/mistserver/integration/api/ We also have a bash and php example here: https://docs.mistserver.org/howto/api/ The bash one most likely comes closest to what you want, as it's using curl, jq, md5sum, cut & cat.

https://github.com/DDVTECH/mistserver/blob/master/api/mist_api.sh

Now if all your API calls will be made locally you can skip the authentication step as well, which does allow a far simpler API through just wget/curl, for example:

wget wget -O - 'http://localhost:4242/api2?command={"push_start":[" STREAM_NAME_WITHIN_MISTSERVER_TO_PUSH","PUSH_TARGET"]}'

curl curl 'http://localhost:4242/api2?command={ "push_start":["STREAM_NAME_WITHIN_MISTSERVER_TO_PUSH","PUSH_TARGET"]}'

(have to escape the {}[] characters else curl will trip on them)

You can also consider using push_auto_add https://docs.mistserver.org/mistserver/integration/api/calls/push_auto_add instead of push_start https://docs.mistserver.org/mistserver/integration/api/calls/push_start in case you want the push attempt to auto-restart upon failure/disconnect. Push_start is a one-time event which will stop the moment it can no longer push or fails to start, whereas push_auto_add will stay configured and repeat every time, so you will have to push_auto_remove https://docs.mistserver.org/mistserver/integration/api/calls/push_auto_remove those to truly disable them.

Now we do have plans in the future to expose parts of the interface with limited access to accounts that would make this easier. However that's still quite a bit in the future as it isn't a huge priority right now.

With kind regards,

Balder Viëtor Head of Testing

MistServer

On Tue, Apr 16, 2024 at 8:25 PM Connor Hackenberg @.***> wrote:

Hey all,

We use Mist Server for our community Discord server driven live streams. One feature I would love to implement is a panel for our participants to control their stream RTMP pushes. The issue is I haven't been able to find in the documentation a way for streams to be assigned by users or I can do this byself as well. But the main issue is where is the documentation to use curl or some kind of API to set a new push URL to a stream. I haven't been able to find this anywhere and I was wondering if someone can guide me to some piece of documentation or even better an example of the URL!

Thankyou all for your time!

— Reply to this email directly, view it on GitHub https://github.com/DDVTECH/mistserver/issues/193, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAN2RJFMIFPQDXO4BLZQBR3Y5VUJJAVCNFSM6AAAAABGJ3XKLCVHI2DSMVQWIX3LMV43ASLTON2WKOZSGI2DMNRUHAYTQNI . You are receiving this because you are subscribed to this thread.Message ID: @.***>

MapGuy11 commented 6 months ago

Hey there, The API documentation can be found here: https://docs.mistserver.org/mistserver/integration/api/ We also have a bash and php example here: https://docs.mistserver.org/howto/api/ The bash one most likely comes closest to what you want, as it's using curl, jq, md5sum, cut & cat. https://github.com/DDVTECH/mistserver/blob/master/api/mist_api.sh Now if all your API calls will be made locally you can skip the authentication step as well, which does allow a far simpler API through just wget/curl, for example: wget wget -O - 'http://localhost:4242/api2?command={"push_start":[" STREAM_NAME_WITHIN_MISTSERVER_TO_PUSH","PUSH_TARGET"]}' curl curl 'http://localhost:4242/api2?command={ "push_start":["STREAM_NAME_WITHIN_MISTSERVER_TO_PUSH","PUSH_TARGET"]}' (have to escape the {}[] characters else curl will trip on them) You can also consider using push_auto_add https://docs.mistserver.org/mistserver/integration/api/calls/push_auto_add instead of push_start https://docs.mistserver.org/mistserver/integration/api/calls/push_start in case you want the push attempt to auto-restart upon failure/disconnect. Push_start is a one-time event which will stop the moment it can no longer push or fails to start, whereas push_auto_add will stay configured and repeat every time, so you will have to push_auto_remove https://docs.mistserver.org/mistserver/integration/api/calls/push_auto_remove those to truly disable them. Now we do have plans in the future to expose parts of the interface with limited access to accounts that would make this easier. However that's still quite a bit in the future as it isn't a huge priority right now. With kind regards, Balder Viëtor Head of Testing MistServer On Tue, Apr 16, 2024 at 8:25 PM Connor Hackenberg @.> wrote: Hey all, We use Mist Server for our community Discord server driven live streams. One feature I would love to implement is a panel for our participants to control their stream RTMP pushes. The issue is I haven't been able to find in the documentation a way for streams to be assigned by users or I can do this byself as well. But the main issue is where is the documentation to use curl or some kind of API to set a new push URL to a stream. I haven't been able to find this anywhere and I was wondering if someone can guide me to some piece of documentation or even better an example of the URL! Thankyou all for your time! — Reply to this email directly, view it on GitHub <#193>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAN2RJFMIFPQDXO4BLZQBR3Y5VUJJAVCNFSM6AAAAABGJ3XKLCVHI2DSMVQWIX3LMV43ASLTON2WKOZSGI2DMNRUHAYTQNI . You are receiving this because you are subscribed to this thread.Message ID: @.>

Thank you so much for this information! I will now close this!