MySpace Developer Platform

A Place For Developers

Welcome Developers!

in

Welcome!

in

POST makeRequest fails with errorCode="internalError"

Last post 03-14-2008 1:49 PM by Brendan. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 03-13-2008 2:54 PM

    POST makeRequest fails with errorCode="internalError"

    Here's my code:

      var params = {}
      params[gadgets.io.RequestParameters.METHOD] = gadgets.io.MethodType.POST;
      params[gadgets.io.RequestParameters.CONTENT_TYPE] = gadgets.io.ContentType.TEXT;
      params[gadgets.io.RequestParameters.POST_DATA] = gadgets.io.encodeValues(data); // data is a json object string
      params[gadgets.io.RequestParameters.AUTHORIZATION] = gadgets.io.AuthorizationType.SIGNED;

      gadgets.io.makeRequest(typeracerUrl, requestTyperacerIframeCallback, params);

    Any ideas?

    Thanks in advance,

     Alex 

    Filed under:
  • 03-13-2008 6:29 PM In reply to

    Re: POST makeRequest fails with errorCode="internalError"

     I am seeing this as well.

                var url = "http://www.mogreet.com/send/vip/45/";
                var params = {};
                 params[gadgets.io.RequestParameters.METHOD] = gadgets.io.MethodType.POST;
                params[gadgets.io.RequestParameters.CONTENT_TYPE] = gadgets.io.ContentType.DOM;  

                 params[gadgets.io.RequestParameters.POST_DATA] = { foo : 'bar' };
                //params[gadgets.io.RequestParameters.POST_DATA] = sendFormData;
                  gadgets.io.makeRequest(url, makeRequest_Callback, params);

     

    The result returned to the browser is the error page from the Myspace web server:...

    <html>    <head>  <title>Runtime Error</title>
            <style>
             body {font-family
    ....etc. 
    If I change the POST to GET (nothing else changes) it does not crash, but of course I lose my post variables. 
     
    Any thoughts?
    ATR
      
     

     

  • 03-14-2008 12:42 PM In reply to

    Re: POST makeRequest fails with errorCode="internalError"

    My code is working like so: 

    var p = {};
    p[gadgets.io.RequestParameters.METHOD] = gadgets.io.MethodType.POST;
    // post_data is a query_string, ie foo=bar&baz=url%20encoded
    p[gadgets.io.RequestParameters.POST_DATA] = post_data;
    p[gadgets.io.RequestParameters.AUTHORIZATION] = gadgets.io.AuthorizationType.SIGNED;

    gadgets.io.makeRequest(url, callback, p);

    This succeeds, and I can verify the signature correctly.

    My guess is that MySpace is ignoring your content type and attempting to sign your POST data, when instead they should only sign POST data with a content type of application/x-www-form-urlencoded (ie, the query string style that I'm sending).

    Refer to: http://oauth.net/core/1.0/#rfc.section.9.1.1

  • 03-14-2008 1:49 PM In reply to

    Re: POST makeRequest fails with errorCode="internalError"

    You could try urlencoding it and passing it down as a string (omitting content_type):

    Instead of:

    {data:'urlencoded'}
    pass:
    json=%7Bdata%3A%27urlencoded%27%7D
    And then parse it as a parameter string and urldecode the json parameter.

    Hope that works.

     

Page 1 of 1 (4 items)