How to find out if confluence server REST API uses prototype or context in URI-s?

stonecoldcrazyx March 29, 2018

So I've tried to use basic REST call on my local server instance started version 6.4.3 from atlassian SDK with atlas-run-standalone command, and it works like a charm

curl u admin:admin "http://myVmName:1990/confluence/rest/api/content"  | python -mjson.tool

I get a JSON answer and it's all nice. Also works when I type URI in a browser.

Now, at work we also use confluence, one test instance and one prod let's call it. Test is on version 6.6.2 and prod on 6.4.3 (like the one I used in SDK). On both of them similar curl call doesn't work - says page not found. Instances are behind HTTPS so I call curl with -k and -L also (I don't know if there's any loadbalancers or something in front of them). When I'm logged in in browser I try the same thing and get same answer. Now, I've managed to find somewhere the older "prototype" api and I've managed to get 

https://confluence.myCompany.domain/rest/prototype/1/content/57934140

where 57934140 is ID of an existing page and that works!!

 

So my question is? What is the difference, some configuration, settings, missing something? Once again, same confluence versions 6.4.3 - standalone one and SDK. In the docs it says that API is applicable to Confluence server 5.5 and later.

 

Is the problem related to "context" mentioned here? How can I find out should I use it or not?

 

 

 

 

1 answer

1 accepted

1 vote
Answer accepted
Minh Tran
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 5, 2018

Hi @stonecoldcrazyx,

I don't know how your above curl works

curl u admin:admin "http://myVmName:1990/confluence/rest/api/content"  | python -mjson.tool

It seems not correct syntax

Can you share with if you are trying to retrieve a Confluence page via REST api?

stonecoldcrazyx April 5, 2018

Hi @Minh Tran, actually I figure it out by going to our IT and seeing how it was installed. The point is that context was left empty, so simply running without "confluence" in the URL did the trick.

Minh Tran
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 5, 2018

@stonecoldcrazyx right, not all Confluence instances are set up with a context path

I am happy you figured out the problem.

stonecoldcrazyx April 5, 2018

@Minh Tran thanks. I would though still like to know how can I check what is this context path (if any) ? Is this possible? Aside from going to IT and asking them obviously :)

Minh Tran
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 5, 2018

@stonecoldcrazyx an easy way is that you can access confluence url or not

If you can access it, check out the if there is any constant uri path after the domain when you go through different pages

if there is one, that is context path. Otherwise, there is no context path

stonecoldcrazyx April 5, 2018

@Minh Tranah ok I see. So this means that either there is a context named "confluence" or there is no context at all? So for example context cannot be "someRadnomWord" ?

Minh Tran
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 5, 2018

You can use any name for the context. That is configured by the guy who installs Confluence. You can check it out here for more information 

https://confluence.atlassian.com/doc/configuring-the-server-base-url-148592.html

(See changing the context path part)

stonecoldcrazyx April 5, 2018

@Minh TranThanks a lot! This answers my question!

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events