Mailing List Archive

Myth Services API - Authentication
Hi all,

as i'm using the services api partly for a while now - i'm a bit
confused on the services api password authentication...

As described in https://www.mythtv.org/wiki/API_parameters_0.28

Myth/ChangePassword should be there to change the password - from
https://www.mythtv.org/wiki/HTTP_Live_Streaming_Server i conclude that
admin/mythtv are the default credentials.

So far everything works as expected using admin/mythtv as api
credentials - i'm able to use all needed services api methods with
python requests... BUT trying to change this default password using the
above api method Myth/ChangePassword leads to 501 Not Implemented...

Any hints? Is the password change api method really not implemented? And
if it is not - where do i change the api password instead?
An additional question would be whether it is possible to add another
user oder change username from admin to xyz..?

Greetings

Kai
_______________________________________________
mythtv-dev mailing list
mythtv-dev@mythtv.org
http://lists.mythtv.org/mailman/listinfo/mythtv-dev
http://wiki.mythtv.org/Mailing_List_etiquette
MythTV Forums: https://forum.mythtv.org
Re: Myth Services API - Authentication [ In reply to ]
On 09/18/2016 03:41 PM, Kai T. Hillmann wrote:
> Hi all,
>
> as i'm using the services api partly for a while now - i'm a bit
> confused on the services api password authentication...
>
> As described in https://www.mythtv.org/wiki/API_parameters_0.28
>
> Myth/ChangePassword should be there to change the password - from
> https://www.mythtv.org/wiki/HTTP_Live_Streaming_Server i conclude that
> admin/mythtv are the default credentials.
>
> So far everything works as expected using admin/mythtv as api
> credentials - i'm able to use all needed services api methods with
> python requests... BUT trying to change this default password using the
> above api method Myth/ChangePassword leads to 501 Not Implemented...
>
> Any hints? Is the password change api method really not implemented? And
> if it is not - where do i change the api password instead?
> An additional question would be whether it is possible to add another
> user oder change username from admin to xyz..?

It is implemented. From the command line, try this:

curl --data UserName=admin\&OldPassword=mythtv\&NewPassword=somethingElse <BE>:6544/Myth/ChangePassword

It works from Python requests too. There's exactly one HTTP/Protected/Password
to answer your last question.

If you haven't, tail the backend log when trying the above. mythbackend
--setverbose http:debug may help.

If you've set HTTP/Protected/Urls to: /, for example, there's a different
answer (I'll assume you didn't do that.)

--
Bill
_______________________________________________
mythtv-dev mailing list
mythtv-dev@mythtv.org
http://lists.mythtv.org/mailman/listinfo/mythtv-dev
http://wiki.mythtv.org/Mailing_List_etiquette
MythTV Forums: https://forum.mythtv.org
Re: Myth Services API - Authentication [ In reply to ]
Hi Bill,

thanks for your reply.

Am 19.09.2016 um 00:05 schrieb Bill Meek:
> On 09/18/2016 03:41 PM, Kai T. Hillmann wrote:
>> Hi all,
>>
>> as i'm using the services api partly for a while now - i'm a bit
>> confused on the services api password authentication...
>>
>> As described in https://www.mythtv.org/wiki/API_parameters_0.28
>>
>> Myth/ChangePassword should be there to change the password - from
>> https://www.mythtv.org/wiki/HTTP_Live_Streaming_Server i conclude that
>> admin/mythtv are the default credentials.
>>
>> So far everything works as expected using admin/mythtv as api
>> credentials - i'm able to use all needed services api methods with
>> python requests... BUT trying to change this default password using the
>> above api method Myth/ChangePassword leads to 501 Not Implemented...
>>
>> Any hints? Is the password change api method really not implemented? And
>> if it is not - where do i change the api password instead?
>> An additional question would be whether it is possible to add another
>> user oder change username from admin to xyz..?
>
> It is implemented. From the command line, try this:
>
> curl --data
> UserName=admin\&OldPassword=mythtv\&NewPassword=somethingElse
> <BE>:6544/Myth/ChangePassword

I've tried yesterday using json encoding - is that possible too or only
formular based?

I'll try it out in the evening.

Kai
>
> It works from Python requests too. There's exactly one
> HTTP/Protected/Password
> to answer your last question.
>
> If you haven't, tail the backend log when trying the above. mythbackend
> --setverbose http:debug may help.
>
> If you've set HTTP/Protected/Urls to: /, for example, there's a different
> answer (I'll assume you didn't do that.)
>

_______________________________________________
mythtv-dev mailing list
mythtv-dev@mythtv.org
http://lists.mythtv.org/mailman/listinfo/mythtv-dev
http://wiki.mythtv.org/Mailing_List_etiquette
MythTV Forums: https://forum.mythtv.org
Re: Myth Services API - Authentication [ In reply to ]
On 09/19/2016 08:36 AM, Kai T. Hillmann wrote:
...
> I've tried yesterday using json encoding - is that possible too or only
> formular based?

JSON works too. I use this:

https://www.mythtv.org/wiki/Python_API_Examples#The_module_used_in_the_examples_above

which does:

session.headers.update({'Accept':'application/json'})
--
Bill
_______________________________________________
mythtv-dev mailing list
mythtv-dev@mythtv.org
http://lists.mythtv.org/mailman/listinfo/mythtv-dev
http://wiki.mythtv.org/Mailing_List_etiquette
MythTV Forums: https://forum.mythtv.org
Re: Myth Services API - Authentication [ In reply to ]
Am 19.09.2016 um 16:36 schrieb Bill Meek:
> On 09/19/2016 08:36 AM, Kai T. Hillmann wrote:
> ...
>> I've tried yesterday using json encoding - is that possible too or only
>> formular based?
>
> JSON works too. I use this:
>
>
> https://www.mythtv.org/wiki/Python_API_Examples#The_module_used_in_the_examples_above
>
>
> which does:
>
> session.headers.update({'Accept':'application/json'})

Well, i tried it using this utility/api...

#!/usr/bin/env python
import utilities as api
opts={}
opts['user']='admin'
opts['pass']='mythtv'
opts['debug']=True
opts['wrmi']=True
postdata={'username':'admin', 'oldpassword': 'mythtv', 'newpassword':
'test'}
resultDict = api.Send(host='localhost', endpoint='Myth/ChangePassword',
opts=opts, postdata=postdata)

print 'Entire response:', resultDict
#print 'Backend hostname (MythTV profile name) is: ', resultDict['String']

but that lead to

Debug: Missing opts set to False: noetag, nogzip, usexml, wsdl
Debug: New session: <requests.sessions.Session object at 0x7f5058f644d0>
Debug: URL = http://localhost:6544/Myth/version
Debug: 1st 60 bytes of response: {"String": "5.0"}
Debug: URL = http://localhost:6544/Myth/ChangePassword
Debug: The following postdata was included:
username admin
newpassword test
oldpassword mythtv
Entire response: {'Abort': 'Unexpected status returned: 500: URL was:
http://localhost:6544/Myth/ChangePassword'}

Changing the dictionary keys to the camelcase ones won't help...

Some log information (as suggested with --setverbose http:debug):
http://pastebin.com/jXQXJ4j1 - i'm a bit confused - valid authentication
but old password invalid to change?!?

Any ideas left? ;)


_______________________________________________
mythtv-dev mailing list
mythtv-dev@mythtv.org
http://lists.mythtv.org/mailman/listinfo/mythtv-dev
http://wiki.mythtv.org/Mailing_List_etiquette
MythTV Forums: https://forum.mythtv.org
Re: Myth Services API - Authentication [ In reply to ]
On 09/19/2016 03:36 PM, Kai T. Hillmann wrote:
...
> Any ideas left? ;)

Responded (and taking this) off-list because it "works for me".

--
Bill
_______________________________________________
mythtv-dev mailing list
mythtv-dev@mythtv.org
http://lists.mythtv.org/mailman/listinfo/mythtv-dev
http://wiki.mythtv.org/Mailing_List_etiquette
MythTV Forums: https://forum.mythtv.org