Thank you for supporting the Cloud Customer Connect Community in 2024. It's a gift to work with you!

Look back
You're almost there! Please answer a few more questions for access to the Applications content. Complete registration
Interested in joining? Complete your registration by providing Areas of Interest here. Register

Rest API - Get activity (using c#)

edited Apr 26, 2017 9:34PM in Field Service 3 comments

Content

Hello,

I'm trying to connect Rest API to use "get activity", but the response is always "The underlying connection was closed". I already tried with "SecurityProtocolType", "ContentLength=0", "KeepAlive=false", ...

I already tested in Postman with success.

 

Thank you.

 

 

Version

Field Service Cloud

Code Snippet

             var request = HttpWebRequest.Create(string.Format(url, Uri.EscapeDataString("rest-client (ssl-basic auth)"))) as HttpWebRequest;

                const string login = "user@domain";
                const string password = "pass";

                string encoded =  "Basic " + Base64EncodeHelper.EncodeUtf8To64(string.Format("{0}:{1}", login, password));

request.Accept = @"application/json";

request.Headers.Add("Authorization",  encoded);

HttpWebResponse response = (HttpWebResponse)request.GetResponse(); 
        

Howdy, Stranger!

Log In

To view full details, sign in.

Register

Don't have an account? Click here to get started!