Carl
Carl

Reputation: 1

Is is to possible to create an active Clickwrap with API?

I'm trying to create an active Clickwrap using Clickwrap API, but the Clickwrap always end as inactive. It is possible to create an active CLickwrap using API ? My request body:

# Step 3: Construct your clickwrap JSON body
$body = @"
{

  "status": "active",
  "name": "Contrat",
  "requireReacceptance": false,

  "displaySettings": {
    "consentButtonText": "Signer",
    "declineButtonText": "Abandonner",
    "displayName": "Contrat",
    "downloadable": true,
    "format": "inline",
    "hasAccept": true,
    "mustRead": true,
    "mustView": true,
    "requireAccept": true,
    "size": "medium",
    "documentDisplay": "document"
  },
  "documents": [
    {
      "documentBase64": "JVBERi0(...)jcyYWY3M2Q5NmNhMD4KPGM0MGU2ZTE3NmU3YzA0MWZiMjhiNzJhZjczZDk2Y2EwPiBdID4+CnN0YXJ0eHJlZgoyNjc0MwolJUVPRgo=",
      "documentName": "Contrat",
      "fileExtension": "pdf",
      "order": 0
    }
  ]

}
"@

Upvotes: 0

Views: 57

Answers (1)

Inbar Gazit
Inbar Gazit

Reputation: 14050

You need to make another API call to activate the clickwrap. You do it like this:

   # Make a PUT call to the clickwraps endpoint to activate created
    # clickwrap
    uri = f"{CLICKWRAP_BASE_URI}/{ds_client.account_id}/clickwraps/{clickwrap_id}/versions/1"
    response_active = ds_client.api_client.call_api(
        uri, 'PUT', body={'status': 'active'}, response_type='object'
    )
    return response_active[0]

Upvotes: 2

Related Questions