sugarcrm - Sugar CRM REST API calls over POST always return documentation -
sugarcrm - Sugar CRM REST API calls over POST always return documentation -
i issuing next login api request (using fiddler) sugar 6.5.4 server, , ever post request documentation sugarwebserviceimplv4_1.php
. expect json response session id (or error?).
what doing wrong?
i have tried v2, v2.1, v3, v3.1, v4, , v4.1 service urls; issue respective documentation response.
request
post https://sugarserver/service/v4_1/rest.php http/1.1 accept: application/json host: sugarserver content-length: 180 expect: 100-continue connection: keep-alive method=login&input_type=json&response_type=json&rest_data={"user_auth":{"user_name":"username","password":"md5passwd"},"application_name":"test"}
response
http/1.1 200 ok date: fri, 20 jun 2014 17:39:16 gmt server: apache/2.2.17 (win32) mod_ssl/2.2.17 openssl/0.9.8o php/5.3.4 mod_perl/2.0.4 perl/v5.10.1 x-powered-by: php/5.3.5 keep-alive: timeout=5, max=100 connection: keep-alive content-type: text/html content-length: 39895 <pre>/** * sugarwebserviceimplv4_1.php * * class implementation class web services. version 4_1 adds limit/off back upwards * get_relationships function. added sync_get_modified_relationships function phone call version * 1 facilitate querying related meetings/calls contacts/users records. * */ class [ <user> class sugarwebserviceimplv4_1 extends sugarwebserviceimplv4 ] { ...
if, on other hand, send request, valid response. why post not working?
with post, can't move rest_data
parameter -- or raw json object without rest_data
parameter name -- request body, both cause "invalid login" json response.
request
get https://sugarserver/service/v4_1/rest.php?method=login&input_type=json&response_type=json&rest_data=%7b%22user_auth%22:%7b%22user_name%22:%22username%22,%22password%22:%22md5passwd%22%7d,%22application_name%22:%22test%22%7d http/1.1 accept: application/json host: sugarserver connection: keep-alive
response
date: fri, 20 jun 2014 20:56:05 gmt server: apache/2.2.17 (win32) mod_ssl/2.2.17 openssl/0.9.8o php/5.3.4 mod_perl/2.0.4 perl/v5.10.1 x-powered-by: php/5.3.5 set-cookie: phpsessid=redacted; path=/ expires: thu, 19 nov 1981 08:52:00 gmt cache-control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 pragma: no-cache content-length: 967 keep-alive: timeout=5, max=100 connection: keep-alive content-type: text/html {"id":"redacted","module_name":"users","name_value_list"...}
ugh - content-type on request. must set url-encoded form, post request works.
content-type: application/x-www-form-urlencoded; charset=utf-8
rest sugarcrm
Comments
Post a Comment