#1 2017-09-21 09:58:52

linbren
Member
Registered: 2017-08-11
Posts: 42

post param via form-data signature problem

I am using George's demo as server, postman as client.
while the url as below work well.
http://localhost:777/service/RestMethod … f6fcaf8d51

however
http://localhost:777/service/RestMethod … c070a52f89
and params send via form-data or other way but in url
get a 403 result .

question is :  how to get the signature on way 2 , in this way , i think the server did not received the params .

Last edited by linbren (2017-09-21 10:00:10)


Windows 7 64bit. Delphi XE10.2 Professional.

Offline

#2 2017-09-21 15:55:35

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,661
Website

Re: post param via form-data signature problem

Parameters should be sent as Json object, as documented.
With a POST method.

Online

#3 2017-09-22 01:51:58

linbren
Member
Registered: 2017-08-11
Posts: 42

Re: post param via form-data signature problem

sending a json work well.

there was a sector "Sending a JSON object" , it was suppose as a optional but necessary .

on web client , they should trans all the form data to json object ?


Windows 7 64bit. Delphi XE10.2 Professional.

Offline

#4 2017-09-22 07:33:02

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,661
Website

Re: post param via form-data signature problem

Either use Ajax and json with an interface based service.
Or use the MVC part of the framework for web clients,  or method based services.

Online

#5 2017-09-22 08:38:22

linbren
Member
Registered: 2017-08-11
Posts: 42

Re: post param via form-data signature problem

function Sum(val1, val2: Double): Double;
[2,1]  ,   {"val2":2,"val1":1}

function SendCustomRecord(const CustomResult: rCustomRecord): Boolean;
[{"ResultCode":200,"ResultStr":"Awesome","ResultArray":["str_0","str_1","str_2"],"ResultTimeStamp":"2017-09-22T11:18:34"}]

how would i Name the parameter "CustomResult"  in Json Parameter  ,like Method sum ?


Windows 7 64bit. Delphi XE10.2 Professional.

Offline

#6 2017-09-22 08:56:01

linbren
Member
Registered: 2017-08-11
Posts: 42

Re: post param via form-data signature problem

{"CustomResult":{"ResultCode":200,"ResultStr":"Awesome","ResultArray":["str_0","str_1","str_2"],"ResultTimeStamp":"2017-09-22T11:18:34"}}

pass.

which confuse me is : array or object ?


Windows 7 64bit. Delphi XE10.2 Professional.

Offline

#7 2017-09-22 13:42:37

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,661
Website

Re: post param via form-data signature problem

Check the doc.
Both array and object are allowed.

Online

Board footer

Powered by FluxBB