REST CORS Problems question

144 views
Skip to first unread message

Vyacheslav Volov

unread,
Jul 6, 2012, 5:55:55 AM7/6/12
to devtarge...@googlegroups.com
We need to use the REST api in order to GET and POST Userstories. The GET Part works well but the server seems to refuse any POST I try.
I've set up the Response Headers on our IIS, did all I could find (CORS) to get the POST.
I was using mootools but also tried jquery with processData=false, nothing worked. 
Would be nice to get in contact.

Thanks, Daniel 

Alex Fomin

unread,
Jul 6, 2012, 6:56:24 AM7/6/12
to devtarge...@googlegroups.com
Hi,

At the moment CORS are not supported by TP. Could you plz share more info about your scenario?

Thanks,
Alex

Daniel

unread,
Jul 6, 2012, 7:51:47 AM7/6/12
to devtarge...@googlegroups.com
Bad to hear, its not supported, heres my scenario:
We have TP on IIS, as usual,
on the other side our Intranet... it runs with mysql and php...

On the IIS side I have set the Response Headers for CORS:
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: OPTIONS, TRACE, GET, POST, PUT
Access-Control-Allow-Headers: Content-Type,Accept,authorization,x-request,x-request-with
Access-Control-Allow-Credentials: true

On Intranet, or any other Server, I try to POST something (mootools):
var testdata = JSON.encode({
    Name:"TESTSTORY",
    Feature: {
        Id: 7894
    }
});

new Request({
    method:'POST',
    data: testdata,
    headers:{
        'Accept': 'Content-Type, application/json, text/html; charset=utf-8',
        'Authorization': 'Basic [CODE]',
        'Origin': '...',
        'Host' : '
[HOST]',
        'Content-Length':
testdata.length   
},

    url: '[HOST]/TP2/api/v1/UserStories',
    onSuccess: function(a,b){
        ...
    },
    onFailure: function(a,b){
        ...
    }
}).send();

Now here is what I get:

405 Method not Allowed

Response-Header
Access-Control-Allow-Cred...true
Access-Control-Allow-Head...Content-Type,Accept,authorization,x-request,x-request-with
Access-Control-Allow-Meth...OPTIONS, TRACE, GET, POST, PUT
Access-Control-Allow-Orig...*
Cache-Controlprivate
Content-Length3033
Content-Typetext/html; charset=utf-8
DateFri, 06 Jul 2012 11:41:27 GMT
ServerMicrosoft-IIS/7.5
X-AspNet-Version4.0.30319

Request-Header
Accepttext/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Encodinggzip, deflate
Accept-Languagede-de,de;q=0.8,en-us;q=0.5,en;q=0.3
Access-Control-Request-He...authorization,x-requested-with
Access-Control-Request-Me...POST
Cache-Controlno-cache
Connectionkeep-alive
Host[HOST]
Origin[ORIGIN]
Pragmano-cache
User-AgentMozilla/5.0 (Windows NT 6.1; WOW64; rv:11.0) Gecko/20100101 Firefox/11.0

I tried different combinations, e.g. without allow-credentials on IIS.
I tried with and without Authorization, nothing worked.

Thanks,
Daniel

Daniel Trattner

unread,
Oct 15, 2012, 6:37:36 AM10/15/12
to devtarge...@googlegroups.com
Hi Alex,

is there any news about CORS support, is it planned to integrate CORS support?

Regards,

Daniel

Am Freitag, 6. Juli 2012 12:56:24 UTC+2 schrieb Alex Fomin:

Alex Fomin

unread,
Oct 15, 2012, 11:59:56 AM10/15/12
to devtarge...@googlegroups.com
Hi Daniel,

Your idea was registered in TP but has a low priority because there were no similar requests from other customer, sorry.


Thanks,
Alex

Daniel Trattner

unread,
Nov 14, 2012, 7:41:48 AM11/14/12
to devtarge...@googlegroups.com
Hi Alex,

I switched over to php with curl, working nice.

Btw. I had to figure out how to add Attachments to a Userstory with php and soap. I made my first blog post:
Is it ok, when I post the code and/or link on this post (which helped me a lot, thanks for that):

Regards,
Daniel
Reply all
Reply to author
Forward
0 new messages