Is it possible to automate export of some object type tables in csv, for example - after updating information in one object?
Or is it possible to make export of some object type in csv, for example, once per hour?
Hello!
My script for backup:
https://github.com/TerAnYu/jira/blob/master/insight_backup.sh
need command-line JSON processor: https://stedolan.github.io/jq/
The actual version is only on the github!
#!/bin/sh # version: 20190611 # Writer: TerAnYu # need: command-line JSON processor # wget https://github.com/stedolan/jq/releases/download/jq-1.6/jq-linux64 -O jq && chmod +x jq # curl with libssl url=http://127.0.0.1:8080 listreq=/rest/insight/1.0/objectschema/list exportreq=/rest/insight/1.0/objectschema/export/server username="localuser" password="localpassword" archpwd=123456 date=`date +"%Y%m%d_%H%M%S"` data=`curl -s \ --connect-timeout 5 \ -u "${username}":"${password}" \ -H "Accept: application/json" \ -H "Content-Type: application/json" \ -X GET ${url}${listreq}` ids=`echo ${data} | ./jq -r '.objectschemas[].id'` cnt=0 for i in $ids; do name=`echo ${data} | ./jq -r ".objectschemas[${cnt}].name"` countobj=`echo ${data} | ./jq -r ".objectschemas[${cnt}].objectCount"` # echo output: "${cnt}; ${date}; ${i}; ${name}; ${countobj}" cnt=$((cnt+1)) param(){ cat <<EOF { "fileName":"${date}_${name}.zip", "objectSchemaId":"${i}", "includeObjects":"true", "password":"${archpwd}", "objectSchemaName":"${name}", "totalObjectsInExport":"${countobj}" } EOF } status_code=$( curl -s -u ${username}:${password} \ -H "Content-Type: application/json" \ --write-out %{http_code} \ --silent \ --connect-timeout 5 \ -X POST \ --output "/dev/null" \ --data "$(param)" \ "${url}${exportreq}" ) if [ $status_code -ne 200 ] ; then echo "Site bad status (${date}_${name}.zip): $status_code" else echo "Site good status (${date}_${name}.zip): $status_code" fi done exit
with POST /rest/insight/1.0/objectschemaexport/export/server I get status code 404.
what about GET /rest/insight/1.0/objecttype/{id}/export ? has that changed? and are these changes documented?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Artem,
It's not possible to schedule an export in Insight, but we have an open API that could be used so that you can create something on your own, as there is a an end-point to do Bulk Export for object types.
Method is GET, the endpoint is
/rest/insight/1.0/objecttype/{id}/export and the returned type is a binary type i.e. a csv file named export.csv. The query parameters are:
id}","attributesToDisplay":{"attributesToDisplayIds":["12", "34"]},"page":1,"asc":1,"resultsPerPage":25,"includeAttributes":false,"objectSchemaId":"{
id}","iql":""},"objectSchemaId":"{
id}"}"
Also be aware that the parameters in searchParams needs to replaved with your own parameters and if you have more that 25 objects just place that number.
There isn't any built in support to do this, but I can give you the information about the REST-API call used to create an Export, and that way you could trigger this manually on a scheduled basis.
URL: rest/insight/1.0/objectschema/export/server
Method: Post
Parameters:
The provided JSON needs the following parameters:
This will export it to the server at export/insight in the home directory. You could then optionally copy this export and move it somewhere else.
If you need help on creating such a script, you could get in contact with one of out partners. Riada Partners extends the value of our products. If you need a plugin on top of Insight, a migration done, product training, support with a license purchase or help with setup and config, we’ve got the partner for the job. For more information, take a look at https://riada.se/partners/
If you feel like this answered your question, please mark it as accepted :)
Cheers!
Alexander
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Atlassian Community,
The endpoint /rest/insight/1.0/objectschemaexport/export/server worked for me.
Is it possible to specify in the POST body that only certain columns be included in the export?
Best regards,
Laszlo
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The endpoint has recently been changed to:
/rest/insight/1.0/objectschemaexport/export/server
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Does the export endpoint still exist in version 8.6?
I just get "Something went wrong. Contact administrator"
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
We were using the rest/insight/1.0/objectschema/export/server endpoint to schedule an automatic export however once we upgraded to version 8.6 this stopped working - status code is 403.
Has this been intentionally removed or has the url changed?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Artem,
You are missing parameters on the URL,
I have attached an example from using restlet client that you can use to build up the query parameters. They are mentioned earlier in this questions.
Basically you are missing the following section after 798/export in the URL (which of course needs adjustment to your instance:
?searchParams={"iqlSearch":true,"iqlParams":{"objectTypeId":"{1} ","attributesToDisplay":{"attributesToDisplayIds":[ 3587,3593,3594,3598,3603]},"page":1,"asc":1,"resultsPerPage":25,"includeAttributes":false,"objectSchemaId":"{9}","iql":""},"objectSchemaId":"{9}"}&delimiterValue=COLON&charEncoder=UTF8&importable=1
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi, Alexander!
I tried to use GET Method: http://sd.dev.fxclub.org:8080/rest/insight/1.0/objecttype/798/export , where 798 is ID of objecttype PC/Laptop in my ObjectSchema, but i have received error(500 Internal Server Error). Code of error can be seen here: https://pastebin.com/gASM5fzn.
Can you help me?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.