Rest API : Create a record (in c#)

Posted by Rollbase User on 02-Jan-2012 05:02

hi, im exploring the capabilities of rollbase REST API in c#, i have the following codes. //Request declaration. HttpWebRequest request = WebRequest.Create("http://www.mydomain.com/rest/api/create2?sessionid=" + mySessionId + "&objName=myObject&useIds=false&myField1=myTestData&myIntField=20") as HttpWebRequest; //executing the request and retrieving the result HttpWebResponse response = request.GetResponse() the sad part is, it gives me an error 500, is there anything wrong with my url? any help would be appreciated. thanks. fadz

All Replies

Posted by Admin on 02-Jan-2012 11:34

You should analyze text sent back to you in HTTP request to find out error message. Also checking log file on server side would help. Use Masted Zone > View Customer > View Logs.

Posted by Admin on 02-Jan-2012 19:57

hi, thanks for the response.



unfortunately i dont have the access to our Master Zone to view the logs

and the response text says that, "REST API session id not found"

but the session id that i used in the url comes from the response of my login method. and it says that i am successfully logged in.

is there any work around that i need to do?

Posted by Admin on 02-Jan-2012 22:21

Try this in your URL:



"&sessionId="+sessionId+ ...

Posted by Admin on 02-Jan-2012 23:20

thanks, its now working, its because of sessionId case sensitive.



also i noticed that if you enter a string value to an int field, the create statement still proceed with no errors thrown but discard the incorrect data type field.

This thread is closed