public int edit(String serviceName, String tableName, IDictionary <String, Object> update, String id) { var client = new RestClient(new DevlessBuilder().postUrl(rootUrl, serviceName)); var request = new RestRequest(Method.PATCH); request.AddHeader("devless-token", tokenValue); var datatosend = DevlessBuilder.createPatchBody(tableName, update, id); request.AddJsonBody(datatosend); IRestResponse response = client.Execute(request); var output = response.Content; int statusCode = DevlessBuilder.checkStatusCode(output); return(statusCode); }
public int delete(String serviceName, String tableName, String id) { var client = new RestClient(new DevlessBuilder().postUrl(rootUrl, serviceName)); var request = new RestRequest(Method.DELETE); request.AddHeader("devless-token", tokenValue); var datatosend = DevlessBuilder.createDeleteBody(tableName, id); request.AddJsonBody(datatosend); IRestResponse response = client.Execute(request); var output = response.Content; int statusCode = DevlessBuilder.checkStatusCode(output); return(statusCode); }
public int postData(String serviceName, String tableName, IDictionary <String, Object> datatoAdd) { //using RESTSHARP var client = new RestClient(new DevlessBuilder().postUrl(rootUrl, serviceName)); var request = new RestRequest(Method.POST); request.AddHeader("devless-token", tokenValue); var datatosend = DevlessBuilder.createPostBody(tableName, datatoAdd); //short hand request.AddJsonBody(datatosend); //longhand //request.RequestFormat = DataFormat.Json; //request.AddBody(datatoAdd); //executing the request IRestResponse response = client.Execute(request); var output = response.Content; int statusCode = DevlessBuilder.checkStatusCode(output); //Console.WriteLine(statusCode); return(statusCode); }