Node is saved as draft in My Content >> Draft
-
Type of Response while making API
While making API you can have a different kind of response and you have to handle that for displaying data
public IHttpActionResult GetDetails(string Id)
{
logger.Info("GetDetailsById method called");
// BadRequest detected
if (string.IsNullOrEmpty(Id))
{
logger.Error("Id is empty");
return BadRequest("Id is empty!");
}
try
{
var existing = DetailsDataOperations.GetPublicDetailsById(Id);
// URL not found detected
if (existing == null)
return NotFound();
// Everything goes fine then OK
logger.Info("GetDetailsById method completed");
return Ok(existingDetail);
}
// Internal server error gets detected
catch (Exception ex)
{
logger.Error(string.Format("Id : {0}",Id), ex);
return InternalServerError(ex);
}
}
We use IHttpActionResult class which contains definition of these return types
0 Comment(s)