# Sp-config Rules Exported

**URL:** <https://developer.sailpoint.com/discuss/t/sp-config-rules-exported/5233>\
**Category:** SHF Discussion and Questions\
**Created:** [August 2, 2022, 9:59pm UTC](https://developer.sailpoint.com/discuss/t/sp-config-rules-exported/5233 "2022-08-02T21:59:55Z")\
**Posts on this page:** 1\
**Showing post:** 7

<div class="post-metadata">

**Author:** ![tyler\_mairose](https://sea1.discourse-cdn.com/sailpoint/discuss/user_avatar/developer.sailpoint.com/tyler_mairose/32/30112_2.png) [@tyler\_mairose](https://developer.sailpoint.com/discuss/u/tyler_mairose)\
**Post date:** [August 4, 2022, 2:38pm UTC](https://developer.sailpoint.com/discuss/t/sp-config-rules-exported/5233/7 "2022-08-04T14:38:23Z")

</div>

My recommendation would be to use the sp-config call and a scripting language of your choice.

If you call the sp-config with the body below it will export all custom client rules out of IDN.

POST `https://{{sailpoint-org}}/beta/sp-config/export`

```json
{
  "description": "Export Rules from tenant X",
  "excludeTypes": [
  ],
  "includeTypes": [
    "RULE"
  ],
  "objectOptions": {
    "RULE": {
      "includedIds": [
      ],
      "includedNames": [
      ]
    }
  }
}

```

I would then poll the following URL every 15-30 seconds until you get a response `status: "COMPLETE"` that the export is completed and the results are ready for download.  
GET `https://{{sailpoint-org}}/beta/sp-config/export/{exportId}`

```json
{
    "jobId": "d5ac33ca-d2bf-437c-9d90-4764781950f5",
    "status": "COMPLETE",
    "type": "EXPORT",
    "message": null,
    "description": "Export Rules from tenant X",
    "expiration": "2022-08-10T16:08:35Z",
    "created": "2022-08-03T16:08:35.614Z",
    "modified": "2022-08-03T16:08:37.119Z",
    "completed": "2022-08-03T16:08:37.115Z"
}

```

Once the export is complete you can call the download API and loop through each result under the `objects` key. In each result returned, the `object` field will contain the rule that you can then save to a file in your script.

GET `https://{{sailpoint-org}}/beta/sp-config/export/{exportId}/download`

```json
{
    "version": 1,
    "timestamp": "2022-08-03T16:08:36.838579Z",
    "tenant": "X",
    "description": "Export Rules from tenant X",
    "options": {
        "excludeTypes": [],
        "includeTypes": [
            "RULE"
        ],
        "objectOptions": {
            "RULE": {
                "includedIds": [],
                "includedNames": []
            }
        }
    },
    "objects": [
        {
            "version": 1,
            "self": {
                "name": "ConnectorRuleBeforeEntitlement",
                "id": "012c5f6d6c8c4a0f842465a7f6bd7359",
                "type": "RULE"
            },
            "object": {
                "description": "This rule is used for AfterOperation on Webservices Airtable",
                "type": "WebServiceBeforeOperationRule",
                "signature": {
                    "input": [],
                    "output": null
                },
                "sourceCode": {
                    "version": "1.0",
                    "script": "log.info(\"Entering : Before operation rule : Going to print out provisioning plan attribute\");\r\n\r\nString oldResponseMap = (String) oldResponseMap;\r\nlog.info(\"OLD RESPONSE MAP: \" + oldResponseMap);\r\n\r\nMap body = requestEndPoint.getBody();\r\nString jsonBody = (String) body.get(\"jsonBody\");\r\n\r\nlog.info(\"BEFORE OPERATION JSON BODY: \" + jsonBody);"
                },
                "attributes": {
                    "sourceVersion": "1.0"
                },
                "id": "012c5f6d6c8c4a0f842465a7f6bd7359",
                "name": "ConnectorRuleBeforeEntitlement",
                "created": "2022-08-02T17:18:49.506Z",
                "modified": "2022-08-02T20:17:55.024Z"
            },
            "jwsHeader": "eyJhbGciOiJFUzI1NiJ9",
            "jwsSignature": "kTcdLUevOD6AcU6vz8EKOpbpAoeI4tegq-UF6dGbcK_jW3JxuTSTVqo1fSaJZfrgXCIxK3H2I7TzDIyi7a30Hw"
        },
        {
            "version": 1,
            "self": {
                "name": "ConnectorRuleBeforeAirtable",
                "id": "048eb3d55c5a4758bd07dccb87741c78",
                "type": "RULE"
            },
            "object": {
                "description": "This rule is used for BeforeOperation on Webservices Airtable",
                "type": "WebServiceBeforeOperationRule",
                "signature": {
                    "input": [],
                    "output": null
                },
                "sourceCode": {
                    "version": "1.0",
                    "script": "Map body = requestEndPoint.getBody();\r\nString jsonBody = (String) body.get(\"jsonBody\");\r\nlog.info(\"Rule - Show Request Body\");\r\nlog.info(\"Rule - \" + jsonBody);"
                },
                "attributes": {
                    "sourceVersion": "1.0"
                },
                "id": "048eb3d55c5a4758bd07dccb87741c78",
                "name": "ConnectorRuleBeforeAirtable",
                "created": "2022-06-10T18:59:44.443Z",
                "modified": "2022-06-10T19:29:28.154Z"
            },
            "jwsHeader": "eyJhbGciOiJFUzI1NiJ9",
            "jwsSignature": "DKHaTIrHuw0qj-Yz1ZoWdXiYDYtI1MbMIqZVHAFRBmwlaZq91NPBEGI1sUYAU-M1o5KM3EKNwPIUzYzsdDityA"
        }
    ]
}

```

---

_[View the full topic](https://developer.sailpoint.com/discuss/t/sp-config-rules-exported/5233)._
