License Manager for WooCommerce

Easily sell and manage software license keys through your shop

Update a generator

Description

Updates a generator by its ID. The response contains the updated generator data object.

Request URL

PUT/wp-json/lmfwc/v2/generators/4

Body

{
    "name": "Generator edited by the API",
    "charset": "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",
    "chunks": "5",
    "chunk_length": "6",
    "times_activated_max": 1,
    "separator": "+",
    "prefix": "API-",
    "suffix": "-GEN",
    "expires_in": 730
}

Request Example (PHP)

<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "{{host}}/wp-json/lmfwc/v2/generators/4?consumer_key={{consumer_key}}&consumer_secret={{consumer_secret}}",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => false,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "PUT",
  CURLOPT_POSTFIELDS =>"{
    "name": "Generator edited by the API",
    "charset": "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",
    "chunks": "5",
    "chunk_length": "6",
    "times_activated_max": 1,
    "separator": "+",
    "prefix": "ORI-",
    "suffix": "-GIN",
    "expires_in": 730
}",
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
} ?>

Response

{
  "success": true,
  "data": {
    "id": "4",
    "name": "Generator edited by the API",
    "charset": "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",
    "chunks": "5",
    "chunkLength": "6",
    "timesActivatedMax": "1",
    "separator": "+",
    "prefix": "API-",
    "suffix": "-GEN",
    "expiresIn": "730",
    "createdAt": "2019-09-04 18:21:51",
    "createdBy": "1",
    "updatedAt": "2019-09-04 18:22:37",
    "updatedBy": "1"
  }
}