Created
January 12, 2016 13:17
-
-
Save sdumitriu/0a56d94a13a4f2aa52db to your computer and use it in GitHub Desktop.
PhenoTips - Set a specific phenotype mapping for a user via REST
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Change the following three variables to what you need: | |
XAUTH='Admin:admin' | |
USER='Admin' | |
MAPPING='PhenoTips.Detailed physical phenotype configuration' | |
XOBJNR=`curl -s -u ${XAUTH} http://localhost:8080/rest/wikis/xwiki/spaces/XWiki/pages/${USER}/objects | sed -r -e ': start' -e 's/(<\/[^>]+?>)([^\n])/\1\n\2/g' -e 't start' | grep -E '<headline>phenotips_mapping</headline>' -B 5 | grep -E '<number>' | sed -r -e 's/.*>(.*)<.*/\1/'` | |
if [[ -n $XOBJNR ]] | |
then curl -s -o /dev/null -u ${XAUTH} -X PUT -H 'Content-Type: text/plain' -d "${MAPPING}" http://localhost:8080/rest/wikis/xwiki/spaces/XWiki/pages/${USER}/objects/XWiki.ConfigurationClass/${XOBJNR}/properties/value | |
else curl -s -o /dev/null -u ${XAUTH} -X POST -H 'Content-Type: application/x-www-form-urlencoded' -d "className=XWiki.ConfigurationClass&property#property=phenotips_mapping&property#value=${MAPPING}" http://localhost:8080/rest/wikis/xwiki/spaces/XWiki/pages/${USER}/objects | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment