Confluence REST API update issue: Property with name sync-rev is not a String - rest

I am writing a script to update a confluence page through the REST API, using:
curl -u user:password -X PUT -H 'Content-Type: application/json' -d'{"id":173390846,"type":"page","title":"test4","body":{"storage":{"value":"hello world","representation":"storage"}},"version":{"number":10}}' http://confluence.private.com/rest/api/content/173390846
but sometimes i get the following error.
{"statusCode":500,"message":"java.lang.IllegalArgumentException: Property with name sync-rev is not a String"}
This can happen if I manually edited and saved the page, or it can happen without the page having been edited manually.
Sometimes if I run the update again it works, and some times it persists and gives the same error.
The script im writing is bigger than the hello world example, but If I created a new blank page, updated it through the REST API, edited it manually, and attempted to update it again (with version incremented) I got the abovementioned error.
I have not found any mention of the property sync-rev other than in this doc, but it has not helped me in solving my problem.
Our confluence version is 5.9.6
Why am I getting this error, and what can i do/change so that it goes away?

I've got the same problem and asked for help in the atlassian community. You can follow my question at https://answers.atlassian.com/questions/38379050/how-to-update-confluence-pages-using-rest-api
Further I contacted the support as it seems to me that this problem is a bug at confluence. I will keep you updated with the supports response.
Edit: This is what Atlassian suggests:
backup the database since this require manual database delete
run the following SQL query:
// identify how many entries need to be deleted
select count( distinct propertyid) from CONTENTPROPERTIES where propertyname='sync-rev';
// delete all of the entries
delete from CONTENTPROPERTIES where propertyname='sync-rev';
restart Confluence instance
verify if the problem persist
Please note that I have not verified their solution yet.

Related

Using API POST command to 'Type' to console in PythonAnywhere. I can successfully 'Type' to the console, but how do I actually submit the command?

Currently using the PythonAnywhere API to attempt to access a Python script I wrote that is hosted in a Virtual Environment in PythonAnywhere. Using the Bubble API Connector if that matters.
I figured out how to use the POST command in combination with "/api/v0/user/{username}/consoles/{id}/send_input/" to successfully send the text "python HelloWorld.py" to my PA console. However, I don't know how to get the API to actually have the console execute that command / text. Is there some text that represents hitting the 'Enter' button or something of that nature?
Sorry if this is a dumb question or has an obvious solution but I am pretty new to this.
Thanks in advance.
Tried new line tag "/n" as well as combing the PA forums, but no luck finding this specific topic.
Expecting my text to end up in the console (which is happening) and for it to Execute (not happening).

Invalid login, please try again after upgrade from 3.5.10 to 3.6.8

I have created an identical copy of our production instance to my local environment running XAMPP and I am trying to do the following:
After upgrading Moodle from 3.5.10 to 3.6.8 and restoring all plugins etc. I am unable to login. Before upgrading to 3.6.8, I had already performed the following upgrades,
3.4.1 -> 3.4.9
3.4.9 -> 3.5.10
and everything worked fine during those 2 upgrades. I followed exactly the recommended upgrading method as described in moodle's docs.
After successfully upgrading to 3.6.8, I successfully passed the step about the server requirements for the correct php mysql and db versions, I then successfully passed the next step as well for upgrading the database and made sure that all the plugins are fine and had no errors (just some warnings about a few plugins that can be updated to newer version) and after that step finished too, I then got back to the /admin/index.php screen asking me to login. That seemed weird to me because during the previous updates, it never asked me to login after completing the upgrading, but I said, ok. i'll just login. So after trying to login i am constantly getting the message "Invalid login, please try again"
I have tried almost anything here and by anything I mean the following.
First of all, I checked my hashed password in the local database and it is exactly the same with my hashed password in production database.
I then read an article that from moodle 3.1 the logintoken was introduced and since we use the mb2nl theme, I supposed that I just have to add the new input hidden field for this logintoken to the login form but the field was already there and again that was not the issue.
I am at a point where I cannot think of what else might be wrong and I am stuck.
A few more information about our whole setup, we have a Joomla website and our moodle users are actually coming from Joomla, Therefore we use a plugin named Joomdle which connects these 2 CMSs. Our users register to our Joomla website and the Joomdle plugin sends the credentials to moodle and the user is being created to the moodle CMS as well and an entry is being created in the moodle's "user" table. The difference is that moodle generates a different hashed password from the hashed password that joomla does. Anyway, there were no problems at all with logins or anything else since I tried logging in with multiple user accounts in moodle and all worked fine, before upgrading to version 3.6.8.
This is not a Joomdle issue since I already checked this by completely removing Joomdle and this is not the cause. This is probably coming from moodle core but since moodle has NO error reporting or logging at all, I really cannot understand what this is.
To exclude one more matter linked in this question, I already checked and made sure that moodle's password salt is the same both in production and local environments.
I am not sure what is going on here and this is why I desperately need some help from experts.
Solution:
I was able to solve this problem but forgot to come back here and give the solution.
The problem was that, as I said above, we are using the mb2nl theme and the theme's login form did not include the hidden input field to create the logintoken.
On my question above I write somewhere in the middle "I supposed that I just have to add the new input hidden field for this logintoken to the login form but the field was already there and again that was not the issue". I was looking at the wrong place. The login form that I was looking at, was the Moodle's itself login form and not the theme's login form.
I then found the login form in the theme's files and the logintoken hidden input field was indeed missing from there. I added it and then I was able to login normally.
Happened to me today. Executing the cron.php cli script trigered again the upgrade process and solved my problem.

KsqlRestClient.makeKsqlRequest("RUN SCRIPT ...") doesn't work without filling ksql.schema.file.content with the script content yourself

In my Scala application, I am trying to tell my KSQL Server that it should execute the RUN SCRIPT <script> command, using the KsqlRestClient.makeKsqlRequest(String ksql) function. Every time I tried it, nothing happened, even though the response was successful, so I started debugging, where I saw that the response was a success but it also returned some kind of error that the property ksql.schema.file.content was empty.
Since I did not find any documentation as to what to fill this property with, I tried some things and eventually found out that if you fill this property with the contents of your .sql file, the run script command works.
Does anybody know if and with what ksql.schema.file.content should normally be filled and/or if the way I am using it is how your supposed to execute a script in KSQL from a Scala application. I already copy and pasted the text from the makeKsqlRequest into the KSQL CLI and everything worked fine, so there should be no error with that.
There is a Github issue tracking the fact that the RESTful API is not documented / supported yet, (as of March 2018).
It sounds like this is something you may want to add a +1 too.

Get number of github downloads

I'm trying to figure out how to use the Github API to get the number of downloads of a release. I have a test repo called polymer-reptation under my username benlindsay with one tag, 1.0. A Github Developer page here says that to get the information on a single release I can use the command GET /repos/:owner/:repo/releases/:id. I can't figure out how to use that command though. I tried things like curl --user "benlindsay" https://api.github.com/repos/:benlindsay/:polymer-reptation/releases/:1.0 on the command line, the same thing without the colons, and typing similar things into hurl.it. They all just give me
{
"message": "Not Found",
"documentation_url": "https://developer.github.com/v3"
}
at best. Can someone show me to how to use this feature of the API? (an easier way to track downloads would be helpful as well if one exists)
You should use it without the colons, they are there to indicate stuff you should replace.
However, Listing all releases at https://api.github.com/repos/benlindsay/polymer-reptation/releases Returns an empty array... No releases My guess is the API hasn't caught up yet. If this doesn't resolve itself shortly, contact GitHub.

Geoserver Configuration Reload

Not quite sure if I should even be doing this. What I am wanting is I will be dynamically generating my sld file and it looks like when you update the sld in the geoserver admin it does a reload. So I tried to do a reload using the rest api and curl and it does not appear to work.
Here is my Curl
curl -uadmin:password-XPOST http://localhost:8080/geoserver/rest/reload
If there is another way to clear everything so my sld reloads that'd be awesome as well. Just needing to get this working and am not sure why it isn't.
Thank you
I have asked this on the GIS site and received an answer suitable for what I am doing.
https://gis.stackexchange.com/questions/7754/geoserver-configuration-reload
This documentation on the REST API for Configuration Reloading may be what you are looking for...
http://docs.geoserver.org/stable/en/user/restconfig/rest-config-api.html#configuration-reloading
Your curl request seems pretty close, I only had to change it slightly and it worked in my environment...
curl -u admin:password -v -XPOST http://localhost:8080/geoserver/rest/reload
If this doesn't work for you, can you describe more thoroughly in what way it is not working?