Menu

Delete Module

Kola Oyewumi

Basic Usage

This sample usage shows how to delete "Bugs" module entity data. For more request options make changes to the Options parameter.

This implements the set_entry SugarCRM REST API method.

using SugarRestSharp;

string url = "http://191.101.224.189/sugar/service/v4_1/rest.php";
string username = "will";
string password = "will";

var client = new SugarRestClient(url, username, password);
string bugId = "49a8ff9f-e1d4-2135-c132-5855b99916a6";

var request = new SugarRestRequest(RequestType.Delete);
request.Parameter = bugId;

SugarRestResponse response = client.Execute<Bug>(request);

Response (Data)

string deletedBugId = (string) response.Data;

Response (JData)

"49a8ff9f-e1d4-2135-c132-5855b99916a6"

Response (JsonRawRequest)

{
  "resource": "",
  "parameters": [
    {
      "name": "method",
      "value": "set_entry",
      "type": "GetOrPost"
    },
    {
      "name": "input_type",
      "value": "json",
      "type": "GetOrPost"
    },
    {
      "name": "response_type",
      "value": "json",
      "type": "GetOrPost"
    },
    {
      "name": "rest_data",
      "value": "{\"session\":\"5bt0t15n6qci2g490f0e0p9o13\",\"module_name\":\"Bugs\",\"name_value_list\":[{\"name\":\"id\",\"value\":\"49a8ff9f-e1d4-2135-c132-5855b99916a6\"},{\"name\":\"deleted\",\"value\":1}]}",
      "type": "GetOrPost"
    },
    {
      "name": "Accept",
      "value": "application\/json, application\/xml, text\/json, text\/x-json, text\/javascript, text\/xml",
      "type": "HttpHeader"
    }
  ],
  "method": "POST",
  "uri": "http:\/\/191.101.224.189\/sugar\/service\/v4_1\/rest.php"
}

Response (JsonRawResponse)

{
  "statusCode": 200,
  "content": "{\"id\":\"49a8ff9f-e1d4-2135-c132-5855b99916a6\",\"entry_list\":{\"id\":{\"name\":\"id\",\"value\":\"49a8ff9f-e1d4-2135-c132-5855b99916a6\"},\"deleted\":{\"name\":\"deleted\",\"value\":1}}}",
  "headers": [
    {
      "Name": "Pragma",
      "Value": "no-cache",
      "Type": 3,
      "ContentType": null
    },
    {
      "Name": "Content-Length",
      "Value": "165",
      "Type": 3,
      "ContentType": null
    },
    {
      "Name": "Cache-Control",
      "Value": "no-store, no-cache, must-revalidate, post-check=0, pre-check=0",
      "Type": 3,
      "ContentType": null
    },
    {
      "Name": "Content-Type",
      "Value": "application\/json; charset=UTF-8",
      "Type": 3,
      "ContentType": null
    },
    {
      "Name": "Date",
      "Value": "Sun, 18 Dec 2016 03:32:52 GMT",
      "Type": 3,
      "ContentType": null
    },
    {
      "Name": "Expires",
      "Value": "Thu, 19 Nov 1981 08:52:00 GMT",
      "Type": 3,
      "ContentType": null
    },
    {
      "Name": "Set-Cookie",
      "Value": "PHPSESSID=5bt0t15n6qci2g490f0e0p9o13; path=\/",
      "Type": 3,
      "ContentType": null
    },
    {
      "Name": "Server",
      "Value": "Apache\/2.4.7 (Ubuntu)",
      "Type": 3,
      "ContentType": null
    },
    {
      "Name": "X-Powered-By",
      "Value": "PHP\/5.5.9-1ubuntu4.17",
      "Type": 3,
      "ContentType": null
    }
  ],
  "responseUri": "http:\/\/191.101.224.189\/sugar\/service\/v4_1\/rest.php",
  "errorMessage": null
}

Related

Wiki: Home
Wiki: Request Options
Wiki: Welcome to SugarRestSharp wiki!
Wiki: _Sidebar

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.