Pinku

Pinku

  • 1.4k
  • 308
  • 46.5k

How to pass an URL as a response in WEB API

Oct 16 2019 11:04 PM
Below is the service i need to call
 
public class JobDraftService : BaseAPIService, IJobDraftService
{
public JobDraftService() : base() { }
public JobDraftService(SerializationInfo Info, StreamingContext Context) : base(Info, Context) { }
[TargetPool(PoolType.CBSvc, UseFormElements = false, UseNeoData = false, UseSession = false)]
public virtual JPResponse<string> GetJobDraft(INeo neo, string jobDraftDid)
{
var response = new JPResponse<string>();
JobDraftRepository jobDraftRepo = new JobDraftRepository();
var jobDraft = jobDraftRepo.LoadSingleJobDraft(neo as Neo, jobDraftDid);
response.Results.Add(jobDraft.JobDetails);
response.Results.Add(jobDraftDid);
response.Results.Add(jobDraft.JobDesc ?? "");
response.Results.Add(jobDraft.JobReq ?? "");
return response;
}
 
now by using that service i should create a api,which is like the below one..
 
 
[JWTAuthorizationFilter("/corporate/jobposterapi")]
public class JobDraftsController : BaseAuthorizationController
{
public string Get(string id)
{
try
{
var jobDraftService = RemoteCallRunner.MakeRemoteProxy<JobDraftService>();
return JsonConvert.SerializeObject(jobDraftService.GetJobDraft(MyCBNeo, id));
}
catch
{
Response.StatusCode = 500;
return JsonConvert.SerializeObject("An unknown error occurred while attempting to make your request.");
}
}
here i want to pass an URL as response.. so how can i pass an URL in API.. 
 

Answers (1)