# Restore json via curl

**URL:** <https://discuss.elastic.co/t/restore-json-via-curl/164190>\
**Category:** Kibana\
**Created:** [January 14, 2019, 7:13pm UTC](https://discuss.elastic.co/t/restore-json-via-curl/164190 "2019-01-14T19:13:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hanneu](https://avatars.discourse-cdn.com/v4/letter/h/7ab992/32.png) [@Hanneu](https://discuss.elastic.co/u/Hanneu)\
**Post date:** [January 14, 2019, 7:13pm UTC](https://discuss.elastic.co/t/restore-json-via-curl/164190/1 "2019-01-14T19:13:00Z")

</div>

Hello expert,  
I want to backup and restore kibana saved objects via curl command. For backup purpose, I created kibana\_backup.sh which and below is the backup curl command:-  
[root@labelk ~]# cd /usr/local/scripts/  
[root@labelk scripts]# ls -ltr  
total 8  
-rwxr-xr-x 1 root root 1034 Jan 8 11:08 kibana\_backup.sh  
-rwxr-xr-x 1 root root 363 Jan 8 11:10 kibana\_restore.sh  
[root@labelk scripts]# cat kibana\_backup.sh  
#!/bin/bash  
#########################

# 

# Backup of Kibana saved objects

# 

#########################

KIBANA\_VERSION=5.6.3  
KIBANA\_INDEX=.kibana  
timestamp=$(date +%F)

backupdir=/var/backup

# Backup kibana saved objects

#curl -u ericadmin:q.3#edsM! -XGET '[http://localhost:9200/$KIBANA\_INDEX/dashboard,visualization,search,index-pattern/](http://localhost:9200/%24KIBANA_INDEX/dashboard,visualization,search,index-pattern/)_search' \> $backupdir/kibana\_saved\_objects_$timestamp.json 2\> /dev/null  
curl --user ericadmin:q.3#edsM! -XPOST "[http://localhost:9200/$KIBANA\_INDEX/](http://localhost:9200/%24KIBANA_INDEX/)_search?size=1000&pretty" -d'{"query":{"match\_all":{}}}' \> $backupdir/kibana\_saved\_objects_$timestamp.json 2\> /dev/null

This generates a kibana\_saved\_objects\_2019\_x\_x.json file. ES and Kibana version=5.6.3 . Could you please assist in how can I recover the json file via restore command?

---

<div class="post-metadata">

**Author:** ![jen-huang](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jen-huang/32/74327_2.png) [@jen-huang](https://discuss.elastic.co/u/jen-huang)\
**Post date:** [January 14, 2019, 11:15pm UTC](https://discuss.elastic.co/t/restore-json-via-curl/164190/2 "2019-01-14T23:15:23Z")

</div>

Try this api: [https://www.elastic.co/guide/en/kibana/master/saved-objects-api-create.html](https://www.elastic.co/guide/en/kibana/master/saved-objects-api-create.html)  
It will have to be called for each object.

Note that this is current documentation and your 5.6.3 version may behave differently. There is also a bulk create api documented, but that is not available in 5.x.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [February 11, 2019, 11:15pm UTC](https://discuss.elastic.co/t/restore-json-via-curl/164190/3 "2019-02-11T23:15:25Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
