# In OpenSearch Version 2.12.0 , Snapshot Management curl is not working

**URL:** <https://forum.opensearch.org/t/in-opensearch-version-2-12-0-snapshot-management-curl-is-not-working/18777>\
**Category:** OpenSearch\
**Tags:** troubleshoot, index-management\
**Created:** [April 9, 2024, 1:20pm UTC](https://forum.opensearch.org/t/in-opensearch-version-2-12-0-snapshot-management-curl-is-not-working/18777 "2024-04-09T13:20:34Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dipanshu](https://avatars.discourse-cdn.com/v4/letter/d/b9bd4f/32.png) [@Dipanshu](https://forum.opensearch.org/u/Dipanshu)\
**Post date:** [April 9, 2024, 1:20pm UTC](https://forum.opensearch.org/t/in-opensearch-version-2-12-0-snapshot-management-curl-is-not-working/18777/1 "2024-04-09T13:20:34Z")

</div>

Hi Team ,

As I’m using the Opensearch version 2.12.0 , When i tried to create the SM policy to take backup and create snapshot of my indices , I’m facing issue on my curl command , the command and error is given below -

curl -XPUT “[http://localhost:9200/\_plugins/\_ism/policies/opensearch\_sm\_daily\_backup](http://localhost:9200/_plugins/_ism/policies/opensearch_sm_daily_backup)” -H ‘Content-Type: application/json’ -d’  
{  
“description”: “opensearch\_sm\_daily\_backup”,  
“creation”: {  
“schedule”: {  
“cron”: {  
“expression”: “5 \* \* \* \*”,  
“timezone”: “UTC”  
}  
}  
},  
“snapshot\_config”: {  
“date\_format”: “yyyy-MM-dd-HH:mm”,  
“timezone”: “UTC”,  
“indices”: “test”,  
“repository”: “opensearch\_sm\_repo”,  
“ignore\_unavailable”: “true”,  
“include\_global\_state”: “false”,  
“partial”: “true”,  
“metadata”: {  
“any\_key”: “any\_value”  
}  
}  
}’  
{“error”:{“root\_cause”:[{“type”:“parsing\_exception”,“reason”:“Failed to parse object: expecting token of type [START\_OBJECT] but found [VALUE\_STRING]”,“line”:3,“col”:18}],“type”:“parsing\_exception”,“reason”:“Failed to parse object: expecting token of type [START\_OBJECT] but found [VALUE\_STRING]”,“line”:3,“col”:18},“status”:400}

Same curl i used in the earlier version 1.3.14 opensearch , there is also same issue i faced , but found from the link that SM policy will only work in 2.X version or greater. That’s why i tried with version 2.12.0.

> **[Snapshot Management (SM): A new way to automate snapshots](https://opensearch.org/blog/snapshot-management/)**
>
> OpenSearch is a community-driven, Apache 2.0-licensed open source search and analytics suite that makes it easy to ingest, search, visualize, and analyze data.

Anyone have any idea will helpful for me.

Thanks in Advance.

---

<div class="post-metadata">

**Author:** ![Gsmitt](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.opensearch.org/gsmitt/32/1718_2.png) [@Gsmitt](https://forum.opensearch.org/u/Gsmitt)\
**Post date:** [April 10, 2024, 1:19am UTC](https://forum.opensearch.org/t/in-opensearch-version-2-12-0-snapshot-management-curl-is-not-working/18777/2 "2024-04-10T01:19:25Z")

</div>

Hey @Dipanshu

Did you create a repository to hold your snapshots?

> **[Register Snapshot Repository](https://opensearch.org/docs/latest/api-reference/snapshots/create-repository/)**
>
> Registering or updating a snapshot repository Introduced 1.0

---

<div class="post-metadata">

**Author:** ![Dipanshu](https://avatars.discourse-cdn.com/v4/letter/d/b9bd4f/32.png) [@Dipanshu](https://forum.opensearch.org/u/Dipanshu)\
**Post date:** [April 11, 2024, 2:34pm UTC](https://forum.opensearch.org/t/in-opensearch-version-2-12-0-snapshot-management-curl-is-not-working/18777/3 "2024-04-11T14:34:07Z")

</div>

Yes i create the repository first after then i run this curl , if you see the repo name is also mentioned in the curl given below like -

“repository”: “opensearch\_sm\_repo”,

---

<div class="post-metadata">

**Author:** ![Gsmitt](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.opensearch.org/gsmitt/32/1718_2.png) [@Gsmitt](https://forum.opensearch.org/u/Gsmitt)\
**Post date:** [April 11, 2024, 9:11pm UTC](https://forum.opensearch.org/t/in-opensearch-version-2-12-0-snapshot-management-curl-is-not-working/18777/4 "2024-04-11T21:11:47Z")

</div>

Hey @Dipanshu

> [@Dipanshu](#):
>
> [START\_OBJECT] but found [VALUE\_STRING]”,“line”:3,“col”:18

Did you check Line 3 col 18 see what was wrong?

EDIT: I broke down your curl command error, I think this is where the issue is.

> [@Dipanshu](#):
>
> {“error”:{“root\_cause”:[{“type”:“parsing\_exception”,“reason”:“Failed to parse object: expecting token of type [START\_OBJECT] but found [VALUE\_STRING]”,“line”:3,“col”:18}],“type”:“parsing\_exception”,“reason”:“Failed to parse object: expecting token of type [START\_OBJECT] but found [VALUE\_STRING]”,“line”:3,“col”:18},“status”:400}

- **parsing\_exception:** Indicates that there was an error while parsing the data.

- **Failed to parse object** : It couldn’t parse the data as an object.

- **expecting token of type [START\_OBJECT] but found [VALUE\_STRING]**: It expected the beginning of an object ({) but found a string value instead. This suggests that the data might not be formatted correctly.

---

<div class="post-metadata">

**Author:** ![Gsmitt](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.opensearch.org/gsmitt/32/1718_2.png) [@Gsmitt](https://forum.opensearch.org/u/Gsmitt)\
**Post date:** [April 11, 2024, 9:54pm UTC](https://forum.opensearch.org/t/in-opensearch-version-2-12-0-snapshot-management-curl-is-not-working/18777/5 "2024-04-11T21:54:21Z")

</div>

Give this a try, hope it helps.

```auto
curl -XPUT "http://localhost:9200/_plugins/_ism/policies/opensearch_sm_daily_backup" -H "Content-Type: application/json" -d '
{
  "description": "opensearch_sm_daily_backup",
  "creation": {
    "schedule": {
      "cron": {
        "expression": "5 * * * *",
        "timezone": "UTC"
      }
    }
  },
  "snapshot_config": {
    "date_format": "yyyy-MM-dd-HH:mm",
    "timezone": "UTC",
    "indices": "test",
    "repository": "opensearch_sm_repo",
    "ignore_unavailable": true,
    "include_global_state": false,
    "partial": true,
    "metadata": {
      "any_key": "any_value"
    }
  }
}'

```

- Replaced the double quotation marks around the URL with single quotation marks.

- Ensured that all keys and string values are enclosed in double quotation marks (") as per JSON standard.

- Replaced the boolean values true and false without quotation marks.

- Formatted the JSON data for better readability.
