MySpace Open Platform

A Place For Developers

Welcome Developers!

in

Welcome!

in

badRequest error code: should be strings?

Last post 09-21-2009 12:36 PM by Test User. 5 replies.
Page 1 of 1 (6 items)
Sort Posts: Previous Next
  • 09-16-2009 8:50 AM

    • Clint
    • Not Ranked
    • Joined on 04-02-2008
    • Posts 4

    badRequest error code: should be strings?

     Hi there,

    Having a problem solving this error code posting an activity with the following template generated code I pasted into my sample app:

    var params = {};
    params[opensocial.Activity.Field.TITLE_ID] = "maintemplate";
    params[opensocial.Activity.Field.TEMPLATE_PARAMS] = {"action":"did something"};

    var mediaItemArray = [;
    params[opensocial.Activity.Field.MEDIA_ITEMS] = mediaItemArray;

    var activity = opensocial.newActivity(params);
    opensocial.requestCreateActivity(activity, opensocial.CreateActivityPriority.HIGH, opt_callBack);

     

    I get the following error in the callback:

    badRequest Field opensocial.Activity.Field.TEMPLATE_PARAMS contains invalid types. Values shuold be strings.

    Yes "should" is spelled incorrectly :)

     

    Has anyone figured out how to get past this?

     

  • 09-17-2009 8:42 AM In reply to

    Re: badRequest error code: should be strings?

     Clint,

    Sorry to hear you ran into some issues. 

    The line  "var mediaItemArray = [;" is that a typo? (This is probably a limitation of this forum editor.)

    Honestly I've never seen this issue before. 

    Your variable type "action" is indeed defined as a Literal. So it should be good.

    Let me investigate a bit futher. I get back to you on this.

     


    Thanks,

    Marco

     

  • 09-17-2009 9:24 AM In reply to

    Re: badRequest error code: should be strings?

     Clint,

    Looking at your code. You are not calling?

        var params = {};
        params[opensocial.Activity.Field.TITLE_ID] = "maintemplate";
        params[opensocial.Activity.Field.TEMPLATE_PARAMS] = {"feedbody":"Hello World!"};

     

    Can you tell me the steps how I can raise an event from your FlashTestAS3 app?

  • 09-17-2009 9:50 AM In reply to

    • Clint
    • Not Ranked
    • Joined on 04-02-2008
    • Posts 4

    Re: badRequest error code: should be strings?

     Hi Marco, thanks for looking at this.

     

    Click the first button next to publish feed (excuse the bad developer interface :) ).  In the log box you can see the response we get from the callback.  The bad code above is definitely a forum post error, as I copied the code directly from the template generator a few different times to be sure.

    Am I to understand that this works for you?

    EDIT:  Marco if I click edit on my post above, the code looks correct.

    Thanks again.

     

  • 09-17-2009 10:20 PM In reply to

    Re: badRequest error code: should be strings?

     Clint,

     I'm still looking at your app 133091 FlashTestAS3. Not able to find your button to test activities.

    I see a link Play | Profile | Challenges.

     I see you are sending a notification when I challenge somebody. 

    I also looked at the Chat. 

     Please advice. 

    Marco

     

  • 09-21-2009 12:36 PM In reply to

    Re: badRequest error code: should be strings?

    Just to close this thread and update the community: The issue is resolved and was caused by two libraries that had definitions for JSON serialization. This was creating conflicts.

    The recommended approach is to use the Gadget.json methods

    http://wiki.opensocial.org/index.php?title=Gadgets.json_%28v0.8%29

    http://wiki.opensocial.org/index.php?title=Gadgets.util_%28v0.8%29

     

    How did we resolve this issue?

     

    I was looking with Firebug to see what the POST request was for activities. It turned out that the request was never made. The gadget container was throwing an error. So that made me point to a pure javascript issue. And not our REST api servers having issues.

     

    Marco

Page 1 of 1 (6 items)