Skip to content

Latest commit

 

History

History
200 lines (128 loc) · 4.32 KB

VariantApi.md

File metadata and controls

200 lines (128 loc) · 4.32 KB

Jsflagr.VariantApi

All URIs are relative to http://localhost/api/v1

Method HTTP request Description
createVariant POST /flags/{flagID}/variants
deleteVariant DELETE /flags/{flagID}/variants/{variantID}
findVariants GET /flags/{flagID}/variants
putVariant PUT /flags/{flagID}/variants/{variantID}

createVariant

Variant createVariant(flagID, body)

Example

var Jsflagr = require('jsflagr');

var apiInstance = new Jsflagr.VariantApi();

var flagID = 789; // Number | numeric ID of the flag

var body = new Jsflagr.CreateVariantRequest(); // CreateVariantRequest | create a variant


var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
apiInstance.createVariant(flagID, body, callback);

Parameters

Name Type Description Notes
flagID Number numeric ID of the flag
body CreateVariantRequest create a variant

Return type

Variant

Authorization

No authorization required

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

deleteVariant

deleteVariant(flagID, variantID)

Example

var Jsflagr = require('jsflagr');

var apiInstance = new Jsflagr.VariantApi();

var flagID = 789; // Number | numeric ID of the flag

var variantID = 789; // Number | numeric ID of the variant


var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully.');
  }
};
apiInstance.deleteVariant(flagID, variantID, callback);

Parameters

Name Type Description Notes
flagID Number numeric ID of the flag
variantID Number numeric ID of the variant

Return type

null (empty response body)

Authorization

No authorization required

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

findVariants

[Variant] findVariants(flagID)

Example

var Jsflagr = require('jsflagr');

var apiInstance = new Jsflagr.VariantApi();

var flagID = 789; // Number | numeric ID of the flag


var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
apiInstance.findVariants(flagID, callback);

Parameters

Name Type Description Notes
flagID Number numeric ID of the flag

Return type

[Variant]

Authorization

No authorization required

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

putVariant

Variant putVariant(flagID, variantID, body)

Example

var Jsflagr = require('jsflagr');

var apiInstance = new Jsflagr.VariantApi();

var flagID = 789; // Number | numeric ID of the flag

var variantID = 789; // Number | numeric ID of the variant

var body = new Jsflagr.PutVariantRequest(); // PutVariantRequest | update a variant


var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
apiInstance.putVariant(flagID, variantID, body, callback);

Parameters

Name Type Description Notes
flagID Number numeric ID of the flag
variantID Number numeric ID of the variant
body PutVariantRequest update a variant

Return type

Variant

Authorization

No authorization required

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json