youngmon/atlassian-qna huggingface dataset:
How use Confluence API from C#
Asked by Mikael:

Hello Comunity

Firs, I'm new to this API so assume no prior knowledge. I'm learning.

I intend to create a Confluence page programmatically via API using C#.

I have browsed internet for several days and found some examples aiding, but should there not be a description of the API somewhere?

My code includes "using Confluence.Client;" and I run it in Viaual Stusio Professional.

Based on examples I attempt log in to Confluence by:

public void loginToConfluence()  
{  
try  
{  
WebRequest request = WebRequest.Create(this.baseURL + this.loginAPI);  
System.String postData = "{\\"username\\":\\"" + this.loginUserName + "\\",\\"password\\":\\"" + this.loginPassWord + "\\"}";  
byte\[\] byteArray = Encoding.UTF8.GetBytes(postData);  
request.Method = "POST";  
request.ContentType = "application/json";  
request.ContentLength = byteArray.Length;

Stream dataStream = request.GetRequestStream();  
dataStream.Write(byteArray, 0, byteArray.Length);  
dataStream.Close();

WebResponse response = request.GetResponse();  
dataStream = response.GetResponseStream();  
StreamReader reader = new StreamReader(dataStream);  
System.String responseFromServer = reader.ReadToEnd();  
reader.Close();  
dataStream.Close();  
response.Close();

this.loginResponse = responseFromServer;  
Console.WriteLine("\\nloginResopnse:");  
Console.WriteLine(this.loginResponse);

}  
catch (Exception ex)  
{  
Console.WriteLine("Error in loginToConfluence: " + ex);  
this.errorsOccurred = true;  
}

Responce:

Started  
Error in loginToConfluence: System.Net.WebException: The remote server returned an error: (403) Forbidden.  
at System.Net.HttpWebRequest.GetResponse()  
at IntToConfluence.JiraRequest.loginToConfluence() in C:\\MLL\\C#\\GetConfluencePage\\Program.cs:line 154  
Finished

I understand the access is refused although I can use the same url to open the page in a browser, using the same UI/PW.

Why does the exception refers to JiraRequest in error message?

Is there a different URL to use than the one used by browser to access the page via api?

Any recommended API documentation?

Any simple C# example recommended are greatly appreciated and will aid my learning!


Answers:
author: Marc - Devoteam
body: HI [@Mikael](/t5/user/viewprofilepage/user-id/5445200)

Welcome to the community but via the API you can't use username and password for authentication.

Authentication is done based on username and API key.

Documentation on the Confluence API can be found here; <https://developer.atlassian.com/cloud/confluence/rest/v1/intro/#about>

The Jira related message is that Cloud uses a single user administration for all Atlassian related products and permissions to be granted.

This is based upon the Jira toolset, thats why it relates to Jira, even if you don't use or have Jira.


Tags: api

c

cloud

confluence-cloud
While trying to push the code to remote getting (pre-receive hook declined)
Asked by Pydisetti Revanth:

Hi This is Revanth, I'm facing one issue from long time.  

When, I'm trying to push my local changes to remote by using git push origin \<branch_name\> command. it is failing with pre-receive hook declined error. \& I'm using   
Windows 10 Pro laptop. Can you please help here me to get it out.


Answers:
author: Pydisetti Revanth
body: Hi [@Marc - Devoteam](/t5/user/viewprofilepage/user-id/3796976)  

By disabling, verify commiter its allowing us to push.  
Fyi -\>   
<https://stackoverflow.com/questions/52886362/error-in-git-you-can-only-push-your-own-commits-in-this-repository>

comments: author: Marc - Devoteam
body: Hi [@Pydisetti Revanth](/t5/user/viewprofilepage/user-id/5448132)

So the suggestion in the older community post resolves the issue.

Great to hear.


author: Marc - Devoteam
body: Hi [@Pydisetti Revanth](/t5/user/viewprofilepage/user-id/5448132)

Welcome to the community.

Check out this community post, I think it's relation to your issues.

[pre-receive-hook-declined-Windows-11](https://community.atlassian.com/t5/Bitbucket-questions/pre-receive-hook-declined-Windows-11/qaq-p/2268487#:~:text=The%20pre%2Dreceive%2Dhook%20declined,requirements%20of%20that%20branch%20restriction.)

comments: author: Pydisetti Revanth
body: I'm able to commit those changes in a new branch. but if I'm trying to push that branch to remote branch.   
Getting pre-receive hooks declined message.


Tags: bitbucket

cloud

confluence-cloud

git
Table transformation with different project languages
Asked by Schmidl82:

Hi everybody,

I'm sure you can help.

Problem:

I have users with different languages set in the user preferences (American English, German).

I perform a table transformation in Confluence based on a JIRA Filter result.

The column names differ, based on the set language.

Like Key/Schl?ssel in German, Summary/Zusammenfassung in German, and so on.

It starts with the SQL query.

SELECT  
T1.'Description'   
FROM T1

works fine, when the language ist set to English.

When set to German, the query stops, as the column does not exist. I get an error massage. The corresponding working SELECT would be

SELECT  
T1.'Beschreibung'   
FROM T1

I'm pretty stuck.

What I need is:  
- a query which is able to read out English and German Column Names, without stopping  
- if its English, rename it to the German name

Thanks in advance,

Christian


Answers:
author: Stiltsoft support
body: Hi [@Schmidl82](/t5/user/viewprofilepage/user-id/5439789) ,

Please check this Community question: <https://community.atlassian.com/t5/Confluence-questions/Can-I-dynamically-populate-the-fields-of-a-table-based-on-values/qaq-p/1505810>

Navigate to the comments from 03 Dec, 2020 regarding English/Danish languages and the COALESCE function, seems you have the same case.

SELECT **COALESCE(T1.'Key', T1.'N?gle') AS 'Key'** , ...

comments: author: Schmidl82
body: perfect! so easy (if you know it) :)


author: Stiltsoft support
body: By the way, you didn't specify your hosting type - if you still have this issue, I assume you are on Data Center and use a rather old version of the Table Filter, Charts \& Spreadsheets app.

The current version is 11.0.0 - please ask your Confluence administrator to check it and update if required.


Tags: filter

jira

language

table

table-filter

table-filter-and-charts

table-filter-charts-spreadsheets

table-transformer

unknown-hosting-type
How to generate automatically reference or ID for each response in Confiforms
Asked by Dhiraj Kr_ Gupta:

I want a unique reference number or I'd for each time a form submitted in Confiforms


Answers:
author: Dhiraj Kr_ Gupta
body: When someone submit form, there is record added for the user in response Of the Form.

Basically, I wanted to create a unique I'd to each record so that I can use them as reference in SQL table transformer

comments: author: Alex Medved _ConfiForms_
body: So, add the ConfiForms Field macro inside your TableView (as I am guessing you are using a table to output responses) and set it's field name parameter to **id**

You will have a column that shows the unique id associated with the record


author: Alex Medved _ConfiForms_
body: HI [@Dhiraj Kr_ Gupta](/t5/user/viewprofilepage/user-id/5375074)

Each record in ConfiForms always have a unique id among the other metadata fields

<https://wiki.vertuna.com/display/CONFIFORMS/Documentation>

Also, having a autonumber field (definition) might help to have a human readable ID

Alex

comments: author: Dhiraj Kr_ Gupta
body: How can I get that unique reference number in the Response, Not getting that in response


author: Alex Medved _ConfiForms_
body: Not sure I understand... what is a "response"?

Where do you want to see that?


Tags: confiforms

unknown-hosting-type
Links to headings end up too low down the page
Asked by erik-foxcroft:

When I create a link to a heading, it takes me to a point a few lines below the heading, which is confusing for readers as the heading is not visible, and the relevant lines may be above the top of the page in the view they land on.

I have noticed this recently and I am sure it used to show the heading at the top of the page, but I do not know when this changed.

Has anyone else seen this behaviour and do you know how to fix it?


Answers:
author: Barbara Szczesniak
body: [@erik-foxcroft](/t5/user/viewprofilepage/user-id/4255248) I just tried this out on a few of my pages and was about to tell you that I'm not seeing this issue in my space, until I did. So, I see this happening with 2 of my links (so far), but not for several others that I tried.

comments: author: erik-foxcroft
body: Are the ones where you are seeing the issue ones which were created recently?


author: Barbara Szczesniak
body: Now that you mention it, yes, they are ones I've added in the last week or so. My older links seem to be working fine.


author: erik-foxcroft
body: I have tracked down some old links now, but they are as bad as the new ones


author: Dan Breyen
body: Hi [@erik-foxcroft](/t5/user/viewprofilepage/user-id/4255248) I took a quick look at [Atlassian's Jira Site](https://jira.atlassian.com/secure/Dashboard.jspa) and I think [CONFCLOUD-77415](https://jira.atlassian.com/browse/CONFCLOUD-77415) is your issue or else it's darn close.

Feel free to vote for an watch it for updates. It looks relatively new.

comments: author: erik-foxcroft
body: It is similar, but I am getting several lines skipped. I have added a note to that issue as well. It looks as though this issue may have arisen quite recently


author: Barbara Szczesniak
body: Thanks, [@Dan Breyen](/t5/user/viewprofilepage/user-id/5086375), I have added my vote on this Jira ticket.


Tags: cloud

confluence-cloud
How to link databases in different spaces?
Asked by Koloman Pfeffer:

I am currently playing around with Confluence databases in beta and for us especially the ability to aggregate data from different databases into one is especially interesting.

To test this, I set everything up, connected the databases and except for some minor hiccups it worked fine. Then I moved the aggregating database to another space, it also showed the same data, but it doesn't update anymore, if I change something in the other, linked, databases.

So apparently this data-link only works if the databases are in the same space, which is not clear from any descriptions or documentation and a big restriction of this feature.

Did anyone find a way to fix this or is this something that will be changed in future updates?


Answers:
author: Kristian Klima
body: Hi [@Koloman Pfeffer](/t5/user/viewprofilepage/user-id/5212398)

How did you connect two Confluence Databases? By exporting DB 1 as a file and importing it into DB 2? I'm genuinely interested.

I have entries from multiple spaces A, B, and C in a DB in space D and those individual entries update just fine.

What I know IS happening with export / import is the following. Your target table should have the exact same setup enabled so that columns are matched and values are interpreted properly.

I tested it with exporting a column of page links and importing it into another DB which did not have the corresponding column defined as page links. If I remember correctly the Confluence links became just regular HTTPs (or text values). Which, I think, is breaking the connection and preventing auto updates.

Don't know if it's your case but perhaps it can give you an idea as to what might be an issue.

(I'm a big fan of Databases, so I'm eager to find out the solution :) )

comments: author: Koloman Pfeffer
body: Hi Kristian,

thank you for your answer.

So I didn't use the export/import feature, as I assumed, this only inserts static data and doesn't create a link between the two databases.

The way, I linked them was via the "entry link field", which let's me choose a database to link to and then chose the value I want to link from (basically just indicates, which row is chosen to display data from) and then the "entry details field" to chose which value I want to have displayed from the row I previously set in the "entry link field".

I hope this explanation makes sense - I had to tinker a bit with it, as the documentation on this feature is a bit lacking, but it worked perfectly when the databases were in the same space, but not anymore, when I moved the database that just displayed the data from two others.

Because of this, I think this "entry link field" is restricted to databases in the same space, but I hope they change this, because it would make this feature a lot more powerful.


author: Kristian Klima
body: Thank you, Koloman, I'm gonna give it a try.


Tags: cloud

confluence-cloud

database

databases
Inline comment function Confluence doesn't work with an header
Asked by DS:

ello everyone

I'm facing up an issue on Confluence.

I created a page "Top Navigation" with an excerpt macro. In which, there are other macros:

* Excerpt
  * Panel
    * Section
      * column
        * divbox
          * image
      * column
        * liveesearch
      * column
        * divbox
          * image

Then, on "look and feel" tool, in header section i have:

{excerpt-include:Top Navigation\|nopanel=true}

But it doesn't matter, even if i write "TEST" in header section, inline comment function doesn't work anymore

Error message: "Could not save the comment"

Confluence 7.19.16

Anyone have an idea?

I need your help please

Best Regards


Answers:
author: DS
body: Hello again everyone

I try to find a solution with a custom layout but it's pretty hard to have what i want.

Any help is welcome.

Best Regards


Tags: confluence-data-center

data-center

header

inline-comment

look-and-feel

macro

server
????????JIRA??????????API????Conflense?????????????????
Asked by Kanta Takeshita:

???JIRA??????????JIRA?????Web?????????????????Conflense??????????????????????

[Create footer comment](https://developer.atlassian.com/cloud/confluence/rest/v2/api-group-comment/#api-footer-comments-post)???????????????????????1??????????????????????????400?????????????

{  
"pageId": "XXXXXXX",  
"body": {  
"representation": "storage",  
"value": "?{{comment.author.displayName}}? {{issue.comments.last.body}} "  
}  
}

????????????


Answers:
author: R_ Fujimura
body: ?????????????????????????

??????????????????html???????????????Jira?????Confluence???????????

* [Html ?????](https://support.atlassian.com/ja/cloud-automation/docs/jira-smart-values-text-fields/#Html-encoding)

{{issue.comments.last.body}} ???????????????????????????????

```
{{htmlEncode(issue.comments.last.body)}}
```

????????????????

comments: author: Kanta Takeshita
body: [@R_ Fujimura](/t5/user/viewprofilepage/user-id/5168025)

???????????

???????

???????????????????????????????????????????????

```
?{{comment.author.displayName}}?//??????????
{{htmlEncode(issue.comments.last.body)}}
```


author: R_ Fujimura
body: [@Kanta Takeshita](/t5/user/viewprofilepage/user-id/5120678) ?

??????????????

????????HTML??????????????????????

* ??????: \<p /\>
* ?????: \<br /\>

```
?: ?{{comment.author.displayName}}?<br />{{htmlEncode(issue.comments.last.body)}}
```

????????????????


author: Kanta Takeshita
body: [@R_ Fujimura](/t5/user/viewprofilepage/user-id/5168025)

???????????????????


Tags: cloud

confluence-cloud
Trying confluence databases but only page creator is seeing the updated content
Asked by Nicola Carraro:

I created a simple database and shared it with colleagues.

I set myself as the only editor, with **view only** rights for everyone else.

Nobody was able to see the table that I had built.

They would all see the empty table that shows up when you create a new database.

I then tried to give **edit** permission to a colleague: he also saw the empty table and tried to add a record: this broke the database, which is now gone for both of us (**undo** will do nothing)

Database looks very promising and it'd solve a lot of use cases, so looking forward to see this problem solved.

PS: likely unrelated, but I'll mention it because it was kind of a similar situation. While trying the **Whiteboard beta,** people would create whiteboards, invite others, but they were not able to see changes made by the creator. This made us abandon the beta.

![2024-03-08_08h41_03.jpg](/t5/image/serverpage/image-id/310984i2E1E7448849F648A/image-size/large?v=v2&px=999 "2024-03-08_08h41_03.jpg")


Answers:
author: Kristian Klima
body: Try embedding the DB in a page using the Embed Database macro. If your colleagues have rights to see that page within the space where the DB is located, they should be able to see it.

comments: author: Nicola Carraro
body: Hi [@Kristian Klima](/t5/user/viewprofilepage/user-id/5074962)

I tried both (sharing the database page \& sharing a page with the embedded database).

I was still **the only one** seeing the updated content.

On the other hand, I would expect this to work from both the original page and the embed.


Tags: cloud

confluence-cloud
How are the free apps become available after requesting hem ?
Asked by Michael Borucki:

Ive requested a bunch of free apps some days ago but there are still not available or i cant find them, nor Ive received no email about the availability. How does the process work ?


Answers:
author: Daniel_Domene_Kolekti
body: What [@marc -Collabello--Phase Locked-](/t5/user/viewprofilepage/user-id/1205132) said, you'd have to check with the person in charge of approving and installing apps in your organisation.


author: marc -Collabello--Phase Locked-
body: Hi [@Michael Borucki](/t5/user/viewprofilepage/user-id/5421242) ,

If you are a normal Confluence user, your administrator must approve all apps you request. So you need to ask your Confluence admin.


Tags: cloud

confluence-cloud
Automation Rule for confluence page classification
Asked by Monika Rani:

Hi There,

How can we achieve the page classification in confluence using automation? I don't want to use any add-on for this. I know some addons provide this functionality, but I want to do it using automation rule or any other way.

Any help?


Answers:
author: Aron Gombas _Midori_
body: What do you exactly mean by "classification"? What would be the categories, what would be the rules that put a page to a category?


Tags: cloud

confluence-cloud
Removing/Hiding "Content" from Sidebar
Asked by Renz Christian:

Hi everyone,

So I've been tasked to research platforms we can use for hosting knowledge bases. I've been able to create the space and pages but I can't seem to find a solution to hiding/removing the "Content" section by the sidebar of Confluence.   

For additional context, there was no option for me to hide/remove it from the "Edit Sidebar" settings.

![Screenshot 2024-03-08 143020.png](/t5/image/serverpage/image-id/310972iC00606BAFBA26E7E/image-size/large?v=v2&px=999 "Screenshot 2024-03-08 143020.png")

My end goal here is that the contents of the "content" section is still accessible, but not visible as we've created shortcuts in the homepage that will allow them to access those pages. Just that having it visible and accessible defeats the purpose of creating shortcuts.


Answers:
author: Kristian Klima
body: [@Renz Christian](/t5/user/viewprofilepage/user-id/5447897) Hello and welcome,

Users can hide it by hitting \[ but, normally, you cannot hide it permanently.\* It would defeat the purpose of Confluence as a collaborative tool.

If you want to separate people who create from people who consume, there are tools that allow you to put a 'skin' on your Confluence space, thus hiding the navigation tree.

Having said that... as a content person, depriving users of navigating / exploring the content, processing the information they see in the context, is detrimental to the purpose of a 'knowledge base'.

If content is the king, then context is the emperor.

Search, links, etc. cannot replace information obtained via natural curiosity. And they certainly don't address the issue of unknown unknowns - users will not ask a question about something they don't know exists ;)

Which is why I steer clear away of tools like Zendesk, Intercom, etc. that do not allow you to present a coherent information structure of content.

\*there might be 'experimental features' or programmatical means in Confluence that allow you to do that.


Tags: cloud

confluence-cloud
what is domian in this url = "https://{your-domain}/wiki/api/v2/pages/{id}/attachments"
Asked by Sachin Somannavar:

this is for rest api v2 , this url will give the attachemenst

url = "https://{your-domain}/wiki/api/v2/pages/{id}/attachments"

but for rest api 1

we have this url = <https://api.atlassian.com/ex/confluence/cloudid/rest/api/content/{page_id}/child/attachment>' and getting all the attachements , since it is depricating , we need to move to rest api v2 , but I am geting the issue finding out the domian and I am using the acess token getting from Oauth2.0 for rest api 1 and it working and same I am using for rest api v2

url = "https://{your-domain}/wiki/api/v2/pages/{id}/attachments" , finding difficulties in what is the domain and how to get details from this rest api v2 url


Answers:
author: Sebastian Krzewi?ski
body: HI [@Sachin Somannavar](/t5/user/viewprofilepage/user-id/5428744)

{{your-domain}} is your instance. E.g. Let's assume that we are working on Confluence <https://greatcompany.atlassian.net> and greatcompany.atlassian.net is {{your-domain}}.

Regards,

Seba

comments: author: Sachin Somannavar
body: if we use Oauth2.0 token , then it is not working here

import requests  
from requests.auth import HTTPBasicAuth  
import json  
api_token = ""  
url = f"<https://domain/wiki/api/v2/pages/17924097/attachments>"  
headers = {'Accept': 'application/json'}  
auth = HTTPBasicAuth("", api_token)  
response = requests.request(  
"GET",  
url,  
headers=headers,  
auth=auth  
)  
response.raise_for_status() # Raise an exception for non-200 status codes  
data = response.json()  
print(data) , it is working but if we use this and I have tested this  
but for this  
url = f'<https://domian/wiki/api/v2/pages/17924097/attachments>'  
headers = {'Authorization': f'Bearer {access_token}', 'Accept': 'application/json'}  
response = requests.get(url, headers=headers)  
response.raise_for_status() # Raise an exception for non-200 status codes  
data = response.json()  
print(data)  
return response.json(), here we are getting the access token from Oauth2.0 and this is working well in rest api version like getting the atatchmensts and all the thing but in rest api 2 it is not working


Tags: cloud

confluence-cloud
Exporting to PDF
Asked by David Horne:

Hi team,

I am trying to print from Confluence via the export to PDF and it does not seem to work.

is it possible to establish the text wrap parameters within the macro to make it work?

Cheers

<br />

Dave


Answers:
author: Kristian Klima
body: [@David Horne](/t5/user/viewprofilepage/user-id/5299064)

If exporting PDFs is an inherent part of your workflow and you need customization options, you may need to look around in the marketplace.

Although I don't need PDFs anymore, I always achieved much better results with [Scroll PDF Exporter by K15t](https://marketplace.atlassian.com/apps/7019/scroll-pdf-exporter-for-confluence?tab=overview&hosting=cloud) out of the box than with Confluence native PDF export.


author: TC Wang
body: Hey [@David Horne](/t5/user/viewprofilepage/user-id/5299064) welcome to the community!  

Perhaps you can try [Customize exports to PDF](https://support.atlassian.com/confluence-cloud/docs/customize-exports-to-pdf/). You can customize the title page, page headers, and page footers in the PDF export output.   

Hope the above helps!


Tags: confluence-data-center

data-center

pdf-export