Joseph Yeung
Posts: 0
Joined: Tue Aug 14, 2012 7:48 am

Post request

Hi, Tiggzi team,

It turns out that I tried out Tiggzi UI again to call the Tiggzi database service. It worked and returned in the network:

Image

Whereas if custom javascript is used, it returned in the network:
Image

So, it comes down to the "Accept" parameter?? Please anyone advise.

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

Post request

Hello! Working on it... I'll update as soon as I get any information.

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

Post request

codeRequest Payload
question=&question=abc&choice1=&choice2=&choice3=&choice4=&answer=&explanation=sads+/code

you send data with x-www-form-urlencoded type, not json - it could be cause of Internal Server Error.

Data in json format should look like this:

code{"question":"","choice1":"","choice2":"","choice3":"","choice4":"","answer":"","explanation":"sads+"}/code

Joseph Yeung
Posts: 0
Joined: Tue Aug 14, 2012 7:48 am

Post request

Hi,Marina,

I just now tried set the set the header:
code
xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
/code

The network sent serialized data request in x-www-form-urlencoded type alright, but still the request failed.

What else can I do along this line of "x-www-form-urlencoded" request? or I should try other directions?

Thx!

Joseph Yeung
Posts: 0
Joined: Tue Aug 14, 2012 7:48 am

Post request

It seems that the "Accept" parameter as shown in the network information above must have to do with the failure/ success.

What do you think?

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

Post request

You can use "Accept" parameter as header. You just need to send data on server in json format, not in application/x-www-form-urlencoded.

Set Content-Type:application/json, also you would need to expose data in json format

Joseph Yeung
Posts: 0
Joined: Tue Aug 14, 2012 7:48 am

Post request

I don't get it. What do you suggest?

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

Post request

Sorry. I meant you can ignore Accept: / (it doesn't affect anything). All you need to do is:

1) change application/x-www-form-urlencoded' to application/json;

codexhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');/code

2) send data on server in json format

code{"question":"","choice1":"","choice2":"","choice3":"","choice4":"","answer":"","explanation":"sads+"}/code

this is not correct

codeRequest Payload
question=&question=abc&choice1=&choice2=&choice3=&choice4=&answer=&explanation=sads+/code

Joseph Yeung
Posts: 0
Joined: Tue Aug 14, 2012 7:48 am

Post request

I see. I'd try.

Joseph Yeung
Posts: 0
Joined: Tue Aug 14, 2012 7:48 am

Post request

Hi Marina, thank you.

It seems that your method essentially works. To conclude:
Image

If serialized form data (instead to stringify long arrays) can be used, it would be very much conducive to development. Big thanks anyway!!

Return to “Issues”