Requesting Restful API - nothing Returned?

Using .net c# to request a restful API from interlink for a login reply and nothing returns (response is content size -1),
anybody any ideas on how to solve it please?

API Specification is;

URL=POST:/user/?action=login  
Every API requires a geoSession except the Login which returns the geoSession which should be passed into any further API calls.  This API sets up a session on the GeoPost servers in which all future requests validate against.  
The API requires the username and password base64 encrypting and passed across as an Authorization header in the HTTP request, example: username = DSMITH password = MYPASSWD concatenate the username and password with a colon in between and encrypt to base64 as a single string: DSMITH:MYPASSWD this would result in a string of: RFNNSVRIOk1ZUEFTU1dE which can be applied to the http request as a header of: Authorization: Basic RFNNSVRIOk1ZUEFTU1dE  A returning http response code of 401 means the username or password are incorrect
 
Supported HTTP Headers
content-type
None  
Accept
application/json  

Example Request is shown below:
POST /user/?action=login HTTP/1.1 Host: api.interlinkexpress.com Content-Type: application/json Accept: application/json
Authorization: Basic RFNNSVRIOk1ZUEFTU1dE GEOClient: account/123456 Content-Length: 0
 
Example Response is shown below:
HTTP/1.1 200 OK Content-Type: application/json Content-Length: 84  {
   "error":null,     "data":{         "geoSession":"1234567890ABCDEFGHIJK"     } }

The code that does not return anything is ;

            WebRequest req = WebRequest.Create(@"https://api.interlinkexpress.com/user/?action=login HTTP/1.1");
            req.Method = "POST";
            req.ContentType = "application/json";
            req.Headers["Authorization"] = "Basic " + Convert.ToBase64String(Encoding.Default.GetBytes("MyUserName:MyPassword"));
            req.Headers["GEOClient"] = "account/888888";
            req.ContentLength = 0; 

            HttpWebResponse resp = req.GetResponse() as HttpWebResponse;

            string cReply = resp.ToString();

Open in new window

stephenwildeAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Dhanapal KCommented:
Hi,
Please remove "HTTP/1.1" from request URL while creating WebRequest.
The below code is working:
WebRequest req = WebRequest.Create(@"https://api.interlinkexpress.com/user/?action=login");

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
stephenwildeAuthor Commented:
Thank you very much - now all working
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.