Find string and cut string its reach the particular string
Api Methods
[HttpPost]
[Route("Postmetods")]
public string Getmethod([FromBody] dynamic data)
{
// dynamic to string conversion
string swap = Convert.ToString(data);
//check the particular present or not it return bool value
bool ee = swap.Contains("200");
//body after it will remove before string
string s = swap.Substring(swap.LastIndexOf("body"));
//if present it will show execute Yes else No
if (ee != false)
{
return "Yes";
}
else
{
return "No";
}
return null;
}
Post Man Check The Data
Headers:
Content-Type:application/json
Accept:application/json
Body:
{
"statusCode": 200,
"headers": {
"Pragma": "no-cache",
"x-ms-request-id": "76dd8595-fc9b-4dcd-b518-5818bb76b0f0",
"OData-Version": "4.0",
"Cache-Control": "no-cache",
"Date": "Wed, 22 Mar 2017 13:41:04 GMT",
"Server": "Microsoft-IIS/8.0,Microsoft-HTTPAPI/2.0",
"X-AspNet-Version": "4.0.30319",
"X-Powered-By": "ASP.NET",
"Content-Length": "965",
"Content-Type": "application/json; odata.metadata=minimal",
"Expires": "-1"
},
"body": {
"@odata.context": "http://127.0.0.1/$metadata#datasets('default')/tables('%255Bdbo%255D.%255BCases%255D')/items/$entity",
"@odata.etag": "",
"ItemInternalId": "c01befff-859f-4695-8a67-3f4b28c75fbf",
"Id": 57,
"Origin": "Web App",
"CaseNumber": "00057",
"Description": "Service you have selected:\n Remodeling and Construction:\n Chimney Installation and Repair",
"Subject": "saravananm-Remodeling and Construction",
"Type": "Service Request",
"Selected": "Many THe Ssdks",
"SelectedService": "Show The Catagires",
"Date_1st_Choice": "2017-03-22T00:00:00Z",
"Date_2nd_Choice": "2017-03-22T00:00:00Z",
"Date_Preference": "Any",
"Time_1st_Choice": "8am - 1pm",
"Time_2nd_Choice": "8am - 1pm",
"AddressId": 147,
"PartyId": 31,
"CreatedDate": "2017-03-22T11:10:18.763Z",
"ModifiedDate": "2017-03-22T11:10:18.763Z",
"IsActive": true,
"Sync": "TRUE",
"UpdateSync": "TRUE",
"SfAccountId": "",
"SfContactId": "",
"SfCaseId": "5007SADD98989",
"uid": 9
}
}
[HttpPost]
[Route("Postmetods")]
public string Getmethod([FromBody] dynamic data)
{
// dynamic to string conversion
string swap = Convert.ToString(data);
//check the particular present or not it return bool value
bool ee = swap.Contains("200");
//body after it will remove before string
string s = swap.Substring(swap.LastIndexOf("body"));
//if present it will show execute Yes else No
if (ee != false)
{
return "Yes";
}
else
{
return "No";
}
return null;
}
Post Man Check The Data
Headers:
Content-Type:application/json
Accept:application/json
Body:
{
"statusCode": 200,
"headers": {
"Pragma": "no-cache",
"x-ms-request-id": "76dd8595-fc9b-4dcd-b518-5818bb76b0f0",
"OData-Version": "4.0",
"Cache-Control": "no-cache",
"Date": "Wed, 22 Mar 2017 13:41:04 GMT",
"Server": "Microsoft-IIS/8.0,Microsoft-HTTPAPI/2.0",
"X-AspNet-Version": "4.0.30319",
"X-Powered-By": "ASP.NET",
"Content-Length": "965",
"Content-Type": "application/json; odata.metadata=minimal",
"Expires": "-1"
},
"body": {
"@odata.context": "http://127.0.0.1/$metadata#datasets('default')/tables('%255Bdbo%255D.%255BCases%255D')/items/$entity",
"@odata.etag": "",
"ItemInternalId": "c01befff-859f-4695-8a67-3f4b28c75fbf",
"Id": 57,
"Origin": "Web App",
"CaseNumber": "00057",
"Description": "Service you have selected:\n Remodeling and Construction:\n Chimney Installation and Repair",
"Subject": "saravananm-Remodeling and Construction",
"Type": "Service Request",
"Selected": "Many THe Ssdks",
"SelectedService": "Show The Catagires",
"Date_1st_Choice": "2017-03-22T00:00:00Z",
"Date_2nd_Choice": "2017-03-22T00:00:00Z",
"Date_Preference": "Any",
"Time_1st_Choice": "8am - 1pm",
"Time_2nd_Choice": "8am - 1pm",
"AddressId": 147,
"PartyId": 31,
"CreatedDate": "2017-03-22T11:10:18.763Z",
"ModifiedDate": "2017-03-22T11:10:18.763Z",
"IsActive": true,
"Sync": "TRUE",
"UpdateSync": "TRUE",
"SfAccountId": "",
"SfContactId": "",
"SfCaseId": "5007SADD98989",
"uid": 9
}
}
Comments
Post a Comment