0

I have web rest services which take one parameter that is studentID and bring back with the student record. I am having difficulty in order to pass parameter to service and its literately not happening

string StudentByPeopleCodeServiceURL = https://agentwebservices.ac.uk/Rest/Modules/15427/Screens/U_LookUps/Data/StudentByCode

parameter that I need to pass is

{PeopeCode}= 307242

and code is

HttpWebRequest _Request = (System.Net.HttpWebRequest)WebRequest.Create(string.Format(StudentByPeopleCodeServiceURL));

   try
       {
         _Request.Method = "GET";

         _Request.ContentType = "text/xml";

         _Request.Accept = "text/xml";

         _Request.UserAgent = "Mozilla/4.0+(compatible;+MSIE+5.01;+Windows+NT+5.0";

   _Request.Headers.Add(HttpRequestHeader.AcceptLanguage, "en-us");

   _Request.Headers.Add(HttpRequestHeader.Authorization, token.EBS_Token);

 HttpWebResponse _Response = _Request.GetResponse() as HttpWebResponse;


   _WebServiceStatus.ResponseStatusCode = _Response.StatusCode;
   _WebServiceStatus.ResponseContentLength = _Response.ContentLength;
   _WebServiceStatus.ResponseContentType = _Response.ContentType;

    //rest of code

i have tried passing parameter in url like ?PeopeCode= 307242 but it is not working. The Rest API is external and I don't have any control on it

Many thanks in advance

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
K.Z
  • 5,201
  • 25
  • 104
  • 240
  • 2
    You mean `?PeopleCode=307242` right? You've missed out the L both times. – Equalsk Oct 27 '16 at 14:21
  • yes...I know i miss spell but still same issue not working – K.Z Oct 27 '16 at 14:26
  • If the spelling is correct in your real code then please correct it here. You says "it's not working". How? Error message? Empty value returned? If it's not passed as part of the URL it's possible it has to be submitted some other way such as POST, only the API documentation can tell you this. – Equalsk Oct 27 '16 at 14:31
  • Do you have access to the endpoint documentation ? Can you show a working example to compare ? – djluis Oct 27 '16 at 14:32

1 Answers1

0

If this is a rest web service, try to add the parameter "{PeopeCode}= 307242" to the url like the following example:

https://agentwebservices.ac.uk/Rest/Modules/15427/Screens/U_LookUps/Data/StudentByCode/307242

Normally the querystring is related to search scenarios : REST API DESIGN - Getting a resource through REST with different parameters but same url pattern

Community
  • 1
  • 1
djluis
  • 362
  • 5
  • 19