Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 3 years ago.
Improve this question
I need working example of creating new wiki page in confluence using rest api. I prefer the new page to be created under specific space and specific page. I read their api documentation and looked at few examples they had and still coming short.
Here is an example they had on their site
curl -u admin:admin -X POST -H 'Content-Type: application/json' -d'{"type":"page","title":"new page","space":{"key":"TST"},"body":{"storage":{"value":"<p>This is a new page</p>","representation":"storage"}}}' http://localhost:8080/confluence/rest/api/content/ | python -mjson.tool
I tried above with my space name, new title and changed the url to mysite/rest/api/content
and returned content was basically html page saying the page does not exist or the page exists but you do not have permission. I have confirmed that I have access to confluence wiki and can create new wiki using my credentials.
What is also not clear is in the example above how is it calling the specific api that creates the page? It does not make sense.
similar question was asked on their forum, but no reasonable answer
https://answers.atlassian.com/questions/149561/simple-confluence-rest-api-usage-what-am-i-missing
(I guess my end goal is to be able to create new wiki page on confluence automatically) I am okay to give up on confluence REST API to other solution if necessary.
My suspicion is that you are not using a new-enough version of Confluence. The REST API for creating a new page was introduced in Confluence 5.5 (which came out 8 days ago). The API documentation is versioned, and you should always use the version corresponding to your Confluence release. The 5.5 API docs include the page creation API you need, but older versions do not. You can change the version in the above URL to get the API version matching your Confluence release.
Confluence 5.4 and prior also used a different root prefix for the REST API (/rest/prototype/1/content) which is one possible reason for getting a page not found error.
The example on the Atlassian site is also confusing because it includes an extra "/confluence" in the URL, which you would only need if Confluence were set up with a context path. This could also result in a page not found error if you were using Confluence 5.5+ (although your post suggests that you already corrected for this).
Additionally, you need to tell Confluence that you are using the basic authentication method by adding a special os_authType query parameter.
The following example works for me on Confluence 5.5 (don't forget to change the port and space key as appropriate).
For safety, I also added the appropriate content type to the Accept header, although this seems to be not needed in practice.
curl -v -u admin:admin -X POST -H 'Content-Type: application/json' -H 'Accept: application/json' -d'{"type":"page","title":"new page","space":{"key":"ATTACH"},"body":{"storage":{"value":"<p>This is a new page</p>","representation":"storage"}}}' "http://localhost:8090/rest/api/content/?os_authType=basic"
To answer your last question, the specific API that creates the page is determined by the URL itself and the request method. For example, performing a GET on "/rest/api/content" will fetch an existing page (given the appropriate query parameters), while performing a POST will create a new page.
EDITED TO ADD:
See also my comment below for how to create a page as a child of another existing page, as opposed to just at the top level of a space.
Not REST api, but a work around I put together.
Try this:
To move a page as child page
curl -X GET \
'<your-confluence-URL>/pages/movepage.action?pageId=<page-to-be-moved-pageId>&spaceKey=<target-space-key>&targetTitle=<target-title-of-parent-page>&position=append' \
-H 'authorization: Basic <encoded-username-password>' \
-H 'x-atlassian-token: no-check'
To move a page as top level page in space
curl -X GET \
'<your-confluence-base-URL>/pages/movepage.action?pageId=<page-to-be-moved-pageId>&spaceKey=<target-space-key>&position=topLevel' \...
Related
I understand that this might be too specific but I am still quite new and having some difficulty figuring this out. So, I am hoping someone can offer up a clear command which can achieve my goal.
My goal is to download a page from Moodle. Now, this is Moodle 3.9 but I don't think this matters. The page is a wiki which is part of Moodle. So, there are child pages, links, images, etc. Now, each student gets their own wiki and it is available by URL. However, one must be logged in to access the URL or else a login page will show up.
I did review this question, which seemed like it would help. It even has an answer here which seems specific to Moodle.
By investigating each of the answers, I learned how to get the cookies from Firefox. So, I tried logging into Moodle in my browser, then getting the cookie for the session and using that in wget, according to the Moodle answer cited above.
Everything I try results in a response in Terminal like:
Redirecting output to 'wget-log.4'
I then found out where wget-log files are stored and checked the contents, which seemed to be the login page from Moodle. While I am quite sure I got the cookie correct (copy-and-paste) I am not sure I got everything else correct.
Try as I might (for a couple of hours), I could not get any of the answers to work.
My best guess for the command is as follows:
wget --no-cookies --header "Cookie: MoodleSession=3q00000000009nr8i79uehukm" https://myfancydomainname.edu/mod/ouwiki/view.php?id=7&user=160456
It just redirects me to the wget-log file (which has the Moodle login page).
I should not need any post data since once logged into my browser, I can simply paste this URL and it will take me to the page in question.
Any ideas what the command might be? If not, any idea how I could get some pretty clear (step-by-step) instructions how to figure it out?
For a client using AEM (according to HTTP Header, Communique 4.2.2, but I presume it is a higher version) we have 600 pages worth of updates to make to SEO items like page title and meta description. There are 8000 pages in total on the website.
Does the bulk import feature require me to re-import all content? I.e. download an export of all pages, change values of specific fields, upload all content?
If so, is there then another option to only update specifically the pages I want to change, using the path as identifier?
Trying to avoid plain unnecessary copy and paste :)
Note, I do not have direct access to AEM myself.
I think editing a website without access to the website management tool defeats the purpose of CMS. All page edits should follow workflow of edit-->review-->Approval-->Publish. You ll need the credentials to logon to server to edit pages. Options available to bulk edit page properties:
Option 1: AEM OTB Bulk Editor. Provided you have AEM console access.
Option 2: ACS Tools . This tool is written to update only 2 properties. It can be extended to update more properties. You can directly hit the updateservlet custom implementation. No console access required. But this approach requires development of the custom servlet + AEM deployment.
Option 3: Run series of curl commands. For example
curl -u admin:admin -X POST --data test=sample http://localhost:4502/content/geometrixx/en/toolbar/jcr:content
This updates property 'test' with value 'sample' on page /content/geometrixx/en/toolbar.html. Likewise you can prepare 600 curl commands. No development or console access required. You ll need AEM login credentials (admin:admin) from your OPS team.
Option 4: Using SlingPostServlet. This again requires development and deployment on AEM.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 8 years ago.
Improve this question
Not sure how Fetch as Google will redirected this url https://www.tonergreen.com.my/HP-CF213A-131A-Magenta-Printer-Toner-Cartridge-Value-Pack-2X to wrong URL. Im using Opencart with custom theme, how to fix this? I worry this will affected page seo ranking.
I can confirm that Googlebot is seeing the same behavior that I do as a visitor.
You tried to fetch as Googlebot the http version (not the https) version of the page. When I do the same with curl, your server redirects me to index.php on the https site.
curl --head http://www.tonergreen.com.my/HP-CF213A-131A-Magenta-Printer-Toner-Cartridge-Value-Pack-2X
HTTP/1.1 302 Found
Location: https://www.tonergreen.com.my/index.php?_route_=HP-CF213A-131A-Magenta-Printer-Toner-Cartridge-Value-Pack-2X
When I fetch the https page I get the standard 200 OK response:
curl --head https://www.tonergreen.com.my/HP-CF213A-131A-Magenta-Printer-Toner-Cartridge-Value-Pack-2X
HTTP/1.1 200 OK
Your server is mis-configured, it isn't Google's fault.
The Fetch as Googlebot tool is not making a mistake.
Your question is asked different from what you are trying to do. Eg you are actually trying to view:
http://www.tonergreen.com.my/HP-CF213A-131A-Magenta-Printer-Toner-Cartridge-Value-Pack-2X
You are trying to view a non-https page, and are being redirected to https.
This is unlikely to be anything to do with the theme.
More likely it will be due to something related to your ecommerce software, or some kind of http to https redirection you have.
i am trying to download data from a webpage that uses post method and uses javascript to pass the username/password to function called login.do
is there a way to connect and download the data of the webpage.
please let me know if you need any more information about the situation.
i tried using wget --save-cookies cookies.txt http://x.x.x.x:80
but it doesnt go pass the connecting stage.
Have a look at this question, which is similar to yours. Basically, you will probably have to inspect the POST request and make one yourself using wget that contains the necessary login information.
This API URL gives me the front page of VitaminWater's Facebook page (http://www.facebook.com/vitaminwater):
https://graph.facebook.com/50540568485?fields=id,name,link,picture,posts.fields(message,picture,link,likes)&access_token=...
They have a good deal of content targeted at people in Germany, but no matter what I do, I can't get the API to return it - it always gives me English content. I've tried setting the parameter "locale=de_DE" per Facebook's API reference documentation, as well as passing headers such as "Accept-Language: de" and "Accept-Language: de-DE" None of this works. Is this just broken, or is there some other way to retrieve the content for a specific locale I should be using?
I have no solution but I can confirm that something in API is broken. We are working with monitoring tools from different providers and since March 13 this problem persists and hasn't been solved. Posts from personal and fanpages appearing only randomly in German language.
From an information by one of the tool providers I have learned that they are working together with FB to identify and fix the problem. So maybee it is frustrating to wait but this might be the better approach.