Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • bob baty-barr 1180 posts 1294 karma points MVP
    Mar 10, 2013 @ 01:38
    bob baty-barr
    0

    400 bad request error on xslt save?

    I am getting errors when trying to update the xslt for the alias of the oauth datatype. i am running on localhost? new install on 4.11.3 on sqlCE.

    any thoughts?

    oh, and it errors on front end too.. just generic xslt error.

  • bob baty-barr 1180 posts 1294 karma points MVP
    Mar 23, 2013 @ 18:42
    bob baty-barr
    0

    no thoughts on this?

  • bob baty-barr 1180 posts 1294 karma points MVP
    Mar 23, 2013 @ 18:54
    bob baty-barr
    0

    uninstall, reinstall... careful attention to install details... all better now ;)

  • Justin Moore 41 posts 100 karma points
    Jun 13, 2013 @ 14:00
    Justin Moore
    0

    I'm getting a 400 too, is it because XML support has been discontinued

  • Justin Moore 41 posts 100 karma points
    Jun 13, 2013 @ 15:28
    Justin Moore
    0

    I've been playing round to make this work in Razor on 4.8.1. I got a 400 error because TwitterOAuthDataValue was empty when calling GetLatestTweets, in my case DeserializeValue wasn't happy with the xml I passed so serialised it to json and it's working.

  • Anthony Southworth 46 posts 173 karma points
    Jun 14, 2013 @ 12:12
    Anthony Southworth
    0

    If you're using XSLT you need to switch the Data Format to XML in the Data Type otherwise you get this 400 error. Took me a while to spot :)

  • Brian Milman-Hurst 48 posts 76 karma points
    Jun 17, 2013 @ 10:25
    Brian Milman-Hurst
    0

    Hi Anthony, please could you elaborate on your solution above, which XSLT / Macro would I need to change and which line of code or setting?

    Many thanks (a back end newby)

  • Brian Milman-Hurst 48 posts 76 karma points
    Jun 17, 2013 @ 10:40
    Brian Milman-Hurst
    0

    Just to quickly update, sorted the switch to XML but still unable to save the LatestTweets.xslt file.  Also when I try to use the Latest Tweets within the template I still get Error in XSLT.

    Any thoughts guys?

  • Anthony Southworth 46 posts 173 karma points
    Jun 17, 2013 @ 10:44
    Anthony Southworth
    0

    To use the Latest Tweets Macro (latestTweets.xslt), I had to tick XML in the Data Type because JSON was selected by default and was causing the 400 error.
    Have you authorised the app in the content section? 

    Cheers
    Tony 

  • Justin Moore 41 posts 100 karma points
    Jun 17, 2013 @ 10:45
    Justin Moore
    0

    I couldn't get it working as XSLT, I ended up doing it in razor and json

  • Brian Milman-Hurst 48 posts 76 karma points
    Jun 17, 2013 @ 10:48
    Brian Milman-Hurst
    0

    Hi Anthony,

    Cheers for that, just found it as you replied, even aftr setting up a twitter app I am still getting the same errors both when saving the LatestTweets.Xslt and/or including within the template.

     

     

    Hi justin,

    Sorry, would you be able to provide a step by step process of how to do this for a bck end newby!? :)

  • Anthony Southworth 46 posts 173 karma points
    Jun 17, 2013 @ 10:54
    Anthony Southworth
    0

    Check your Twitter OAuth property is called 'twitter' or amend LatestTweets.xslt to whatever it is:

    <xsl:param name="twitterOAuthPropertyAlias" select="'twitter'" />

     

  • Justin Moore 41 posts 100 karma points
    Jun 17, 2013 @ 11:59
    Justin Moore
    0

    I think my xslt problem may have been not having the property named twitter, I'd called it uTwit.

    Anyway, I took the MVC Partial View code and repurposed it for version 4.8 Razor. eg. for Latest Tweets:

    @using Our.Umbraco.uTwit
    @{
        // *****************************************************************
        // uTwit - Latest Tweets
        // *****************************************************************
    
        // Options
        const string twitterOAuthPropertyAlias = "twitter";
        const int numberOfTweetsToDisplay = 3;
        const bool includeReplies = false;
        const bool includeRetweets = true;
    
        // Render the tweets
        var home = @Model.NodeById(1044);
        string twitterOAuth = home.GetPropertyValue<string>(twitterOAuthPropertyAlias);
            var config = uTwit.DeserializeValue(twitterOAuth);
    
            var tweets = uTwit.GetLatestTweets(config, numberOfTweetsToDisplay, includeReplies, includeRetweets);
            if (tweets != null)
            {
            foreach (var tweet in tweets)
            {
                // Choose the tweet to display
                // If it's a retweet, show the original but add "Retweeted by" at the end,
                // otherwise just show the current tweet.
                var tweetToDisplay = tweet.IsRetweet ? tweet.RetweetedStatus : tweet;
    
                <div class="tweet">
                    <img src="@tweetToDisplay.User.ProfileImageUrl" alt="@tweetToDisplay.User.Name"  />
    
                    <strong>@tweetToDisplay.User.Name </strong>
                    <abbr class="timeago">@uTwit.FormatDate(tweetToDisplay.CreatedAt)</abbr>
                    <p class="tweet-content">@tweetToDisplay.LinkifiedText</p>
                    @if(tweet.IsRetweet)
                    {
                        <p class="retweet"><a href="@tweet.User.PermalinkUrl">Retweeted by @@@tweet.User.ScreenName</a></p>
                    }
    
                    <div class="actions">
                        <a href="https://twitter.com/intent/[email protected]" class="reply">Reply</a>
                        <a href="https://twitter.com/intent/[email protected]" class="retweet">Retweet</a>
                        <a href="https://twitter.com/intent/[email protected]" class="favorite">Favorite</a>
                    </div>
                </div>
            }
    
            }
    
    }

    or you could hardcode your OAuth details like below instead of getting them off a node

        string twitterOAuth = "{'ScreenName': 'YOURTWITTERSCREENNAME','OAuthToken': 'YOUROAUTHTOKEN','OAuthTokenSecret': 'YOUROAUTHTOKENECRET','ConsumerKey': 'YOURCONSUMERKEY','ConsumerSecret': 'YOURCONSUMERSECRET'}";
  • Brian Milman-Hurst 48 posts 76 karma points
    Jun 18, 2013 @ 11:42
    Brian Milman-Hurst
    0

    Hmm struggling here still guys!

    This is the process I am using to install the package:

    • Install Datatype Web Package
    • amend datatype settings to use XML
    • in Document Types, Homepage add new property called twitter and selected the OAuth Data Type
    • Went to Content tab, Homepage and set up the authorisation to the account, this worked fine
    • installed the UTwit Web Package
    • inserted the LatestTweets Macro into the home page template
    Am I doing anything daft here guys!?  Even when doing the above I was still unable to amend the LatestTweets.XSLT due to Err400
  • Anthony Southworth 46 posts 173 karma points
    Jun 18, 2013 @ 12:04
    Anthony Southworth
    0

    That looks to be the right process, are tweets displaying without you amending LatestTweets.XSLT?

    Have you got tweets to display in the Twitter account you linked to in step 4, and have you got any privacy settings setup?

    I got the Razor code posted by Justin above to work, so you could try that. Remember to change the homepage nodeid to whatever yours is, and switch to JSON in the Data Type.

     

  • Justin Moore 41 posts 100 karma points
    Jun 18, 2013 @ 12:12
    Justin Moore
    0

    I got the 400 when didn't pass the oauth stuff so passing null config to :

    var tweets = uTwit.GetLatestTweets(config, numberOfTweetsToDisplay, includeReplies, includeRetweets);

  • Brian Milman-Hurst 48 posts 76 karma points
    Jun 18, 2013 @ 12:31
    Brian Milman-Hurst
    0

    Cheers for all of your help guys... For some bizarre reason it has just started working!  

    I'm not  quite sure which line above to mark as the solution but firgure that all of the advice was tops.

     

    Cheers again guys {phew} :)

  • sd75 31 posts 144 karma points
    Jul 19, 2013 @ 15:59
    sd75
    0

    Having some difficulty here too. All set up as it should be, process was

    • Install Datatype Web Package
    • amend datatype settings to use XML
    • in Document Types, Homepage add new property called twitter and selected the OAuth Data Type
    • Went to Content tab, Homepage and set up the authorisation to the account, this worked fine
    • installed the UTwit Web Package
    • inserted the LatestTweets Macro into the home page template

    keep getting a 'Error parsing XSLT file: \xslt\latestTweets.xslt'

     

    I've noticed that each time I go back to the proprty in the Content Section I need to authorize it again ie the twitter account isn't listed.

     

    Am I doing something wrong?

    Any help greatly appreciated.

  • Brian Milman-Hurst 48 posts 76 karma points
    Jul 19, 2013 @ 16:04
    Brian Milman-Hurst
    0

    In my case when I set up the app I originally used the auth keys in Umbraco (even though they were optional), this didn't work so I removed them and checked the twitter app settings again.  From what I can tell I hadn't set all of the various sections within the twitter app itself and so it couldn't auth with Umbraco.  You don't need to use any of them in Umbraco (as per the instructions) but Twitter does seem to like them being there...

    Vague I know, but it sorted my issues out :)

  • sd75 31 posts 144 karma points
    Jul 19, 2013 @ 16:25
    sd75
    0

    Think I am well & truely lost. I know this should be simple too.

    Beacause I cannot get the feed to work using the standard uTwit application info, I've set up a twitter application to get the Consumer Key & Consumer Key Secret. I've updated these in the data type then went to the content panel to authorize. After clicking on the Authorize app button (on api.twitter.com) it throws a remote server 500 internal server error when redirecting back to the calling application.

     

  • sd75 31 posts 144 karma points
    Jul 19, 2013 @ 16:34
    sd75
    0

    I now understand why I was getting a 500 error as I had not checked the relevant option in the twitter app settings to allow the app to be used to sign in.

    After all this I still get an Error parsing XSLT file: \xslt\latestTweets.xslt  instead of the feed.

     

    Is ther anything I have missed?

  • Brian Milman-Hurst 48 posts 76 karma points
    Jul 19, 2013 @ 16:35
    Brian Milman-Hurst
    0

    I had to change a couple of bits in the XSLT and was still getting an error, to be honest I ticked to ignore errors and after a few minutes of setting the app up correctly (which it sounds like you have) it worked fine.  It did seem to take a few minutes to work after setting it all up..

  • sd75 31 posts 144 karma points
    Jul 19, 2013 @ 16:40
    sd75
    0

    Thanks for your help Brian.

    I'm going to look at it all from scratch to see if I can pinpoint where I have gone wrong.

    Cheers

  • Brian Milman-Hurst 48 posts 76 karma points
    Jul 19, 2013 @ 16:42
    Brian Milman-Hurst
    0

    No worries, it is a bit of a bugger if it doesn't go right the first time!  It took me 3 attempts to suss out the various bits and correct order!

    It works great once it does work though!!

  • sd75 31 posts 144 karma points
    Jul 19, 2013 @ 16:47
    sd75
    0

    Brian - can you tell me, each time you look at the content section (where you authorize Twitter OAuth Data Type) do you see the already athorized account? Each time I go back in nothing is listed, just the authorize link, It looks as if nothing has been authorized & I need to do it again.

    Cheers

  • Brian Milman-Hurst 48 posts 76 karma points
    Jul 19, 2013 @ 16:58
    Brian Milman-Hurst
    0

    Yeah, thats just because it isn't working yet... When it works the connected twitter account is always displayed.  You know when you set up your data type have you included the key and secret??  If so I would delete it as this is one of the items causing mine to not work!  Then give it a couple of minutes and try authorising your app again in the node/page.

  • sd75 31 posts 144 karma points
    Jul 22, 2013 @ 11:36
    sd75
    0

    Can anyone shed any light on a possible solution - I've set everything up what looks like the correct way but still getting a Error parsing XSLT file: \xslt\latestTweets.xslt where I should see the twitter feed.

    I've authorized the app several times but each time I return to the authorize property in the content there is nothing listed & have to re-authorize it.

    Any help greatly appreciated.

  • sd75 31 posts 144 karma points
    Jul 22, 2013 @ 14:07
    sd75
    0

    I've solved it he says rather sheepishly!

    I had not saved & published the home page after authorizing the twitter account - what an idiot I am.

    Thanks for all your help though guys

     

Please Sign in or register to post replies

Write your reply to:

Draft