NOTE: This bug report is for Confluence Server. Using Confluence Cloud? See the corresponding bug report.

      Hi there,

      I was trying a bit of code that accesses confluence API which has authentication enforced on it. Sample is below

      static void Main()

      { string url = @"http://dubconfluence800:8090/rest/api/content/?os_authType=basic/?spaceKey=DOL&title=Dolphin+Test+Cases"; Uri myUri = new Uri(url); WebRequest myWebRequest = HttpWebRequest.Create(myUri); HttpWebRequest myHttpWebRequest = (HttpWebRequest)myWebRequest; string uN = Base64Encode("Brannick"); string pW = Base64Encode("Brannick"); NetworkCredential myNetworkCredential = new NetworkCredential(uN, pW); CredentialCache myCredentialCache = new CredentialCache(); myCredentialCache.Add(myUri, "Basic", myNetworkCredential); myHttpWebRequest.PreAuthenticate = true; myHttpWebRequest.Credentials = myCredentialCache; WebResponse myWebResponse = myWebRequest.GetResponse(); Stream responseStream = myWebResponse.GetResponseStream(); StreamReader myStreamReader = new StreamReader(responseStream, Encoding.Default); string pageContent = myStreamReader.ReadToEnd(); responseStream.Close(); myWebResponse.Close(); Console.WriteLine(pageContent); }

      public static string Base64Encode(string plainText)

      { var plainTextBytes = System.Text.Encoding.UTF8.GetBytes(plainText); return Convert.ToBase64String(plainTextBytes); }

      I'm writing this in C# as it is a requirement for the task i'm doing. As you can see from the code the url in question is the folllowing

      http://dubconfluence800:8090/rest/api/content/?spaceKey=DOL&title=Dolphin+Test+Cases

      when I try that manually in the browser or via code I get the following

      {"statusCode":404,"message":"No space with key : DOL"}

      which is as expected as per manual steps as the page has authentication enabled. However. I would have thought via code I would be ok based on content in the folllowing link

      https://developer.atlassian.com/confdev/confluence-rest-api/confluence-rest-apis-prototype-only/using-the-rest-apis-prototype-only

      Would you have any guidance on the above as to what I may be doing wrong? thanks in advance.

      Btw I got redirected to yourselves by a person from a different team...you can see the details in the folllowing link

      https://ecosystem.atlassian.net/browse/REL-325

              Unassigned Unassigned
              bhrein.brannick1734596588 bhrein.brannick1734596588
              Affected customers:
              0 This affects my team
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: