If you are using API for the first time, ie the consumer_key consumer_secret and oAuth are not configured yet.
It’s quite normal to receive unauthorised(401) error.
Perhaps try to proceed to the next steps in the guide and make sure that you configure everything correctly.
The default.cfg has been updated with the correct path and keys that were generated by adding a application
I am at this point and I do not get the expected output
•Save defaults.cfg and close it •Save your ReplaceVideo,py script •Now lets run what we have:
And I expected the below output, but instead I received the 401 message.
It sounds to me like the keys you’ve entered are wrong. Try deleting the application from inside the CMS and adding it again, then update the keys in defaults.cfg and remove any keys that have been added to site.cfg
Thanks Alex / Peter.
I ran into other issues as well, so I decided to start from scratch. If I run into the same issues again, I will come back on this.
Is there anything I should take in consideration, that I maybe missed, regarding the scripts to run them on a Windows 2008 R2 server with IIS 7?
I have created a new server and installed everything from scratch. Everything is working as expected, except the Replace script. I have followed evrything by the letter in the http://xibo.org.uk/2014/02/19/scripting-xibo-content-management-a-brief-tour-of-the-api/ manual, but I still get the same message. I can assure that the keys are correctly added to the default.cfg.
Has anyone successfully implemented a ReplaceVideo script or a similar script on a Windows 2008 R2 and IIS? Any suggestions that could solve my problem, as I really need this script working.
I have set the logging to Audit and when I run the script the following is added in the logfile “OAuth Webservice call” and the following is added to the Application log.
NOTES: OAuthException2: SQL Error in OAuthStoreMySQL: Array ( [0] => HY000 [1] => 1364 [2] => Field ‘ost_referrer_host’ doesn’t have a default value ) INSERT INTO oauth_server_token SET ost_osr_id_ref = 1, ost_usa_id_ref = 1, ost_token = ‘ef23ea052f5d8c84fffda697d2abce6d0568e26fa’, ost_token_secret = ‘53635952c09d2b9eca5ee84856106440’, ost_token_type = ‘request’, ost_token_ttl = DATE_ADD(NOW(), INTERVAL 3600 SECOND), ost_callback_url = ‘oob’ ON DUPLICATE KEY UPDATE ost_osr_id_ref = VALUES(ost_osr_id_ref), ost_usa_id_ref = VALUES(ost_usa_id_ref), ost_token = VALUES(ost_token), ost_token_secret = VALUES(ost_token_secret), ost_token_type = VALUES(ost_token_type), ost_token_ttl = VALUES(ost_token_ttl), ost_callback_url = VALUES(ost_callback_url), ost_timestamp = NOW() At file C:\inetpub\wwwroot\xibo\3rdparty\oauth-php\library\store\OAuthStoreSQL.php, line 1241
Looks like IIS isn’t setting an http referrer and so when we try and enter a NULL referrer in the database we can’t.
You could run the SQL suggested against the oauth_server_token table in the database but you may then have problems with future database upgrades. That said it’s simple enough to revert so as long as you remember you’ve done that if you do have problems down the line then we’ll know where to start looking.