Gigya Job Openings

ds.delete JS

Skip to end of metadata
Go to start of metadata

Description

 

Deletes an object data or part of it from Gigya's Data Store. 
For security reasons, you may only delete objects that are associated with the currently logged-in user, and you may only delete fields that have the propper write access. You may use the ds.setSchema from your server application, to set the write access to "clientModify" for the relevant data fields, prior to using this method. Learn more in the Storing Data guide.

Note: If you plan on integrating the DS, we highly recommend reading the Data Store Guide.
The DS is a premium platform that requires separate activation. If the DS is not part of your site package please contact your Gigya Customer Engagement Executive or email support@gigya-inc.com.

Syntax

 

Parameters

The following table lists the available parameters:

RequiredNameTypeDescription
oidstringThe ID of the object to delete.
typestring A string indicating the type of the object.
fieldsstringA comma separated list of fields to delete. Acceptable values for this parameter:
  • Data field names, specifying the the complete path, i.e. album.photo.photoTitle_t
  • Partial field names (fields that contain only a part of the path to sub-objects, i.e. album.photo) - indicate to retrieve everything below that path.
  • "*" - indicates to retrieve the entire stored object.
callbackfunction
A reference to a callback function. Gigya calls the specified function along with the results of the API method when the API method completes.
The callback function should be defined with the following signature: functionName(Response).
The "Response Object Data Members" table below provides specification of the data that is passed to the callback function.
contextobject
A developer-created object that is passed back unchanged to the application as one of the fields in the response object.

 

Response Object Data Members

FieldTypeDescription
errorCode integer The result code of the operation. Code '0' indicates success, any other number indicates failure. For a complete list of error codes, see the Response Codes and Errors table.
errorMessage string A short textual description of an error associated with the errorCode for logging purposes.
callId string Unique identifier of the transaction, for debugging purposes.
context object The context object passed by the application as a parameter to the API method, or null if no context object has been passed.

 

Code Sample

// Callback function - print results
function printResult(response) { 
    if ( response.errorCode == 0 ) {  
        alert('The object has been deleted');
    } else {
        alert('Error :' + response.errorMessage);
    }
};

var params={
    oid: 1234,
    type: "car",
    fields: "year_i, brand_s, owner_s",
    callback: printResult 
}

// Call delete method
gigya.ds.delete(params);

Notes:

  • This sample is not meant to be fully functional code. For brevity's sake, only the code required for demonstrating the API call itself is presented.
  • To run the code on your own domain, add your Gigya API key to the gigya.js URL. A Gigya API key can be obtained on the Site Dashboard page on Gigya's website. Please make sure that the domain from which you are loading the page is the same domain name that you used for generating the API key.
  • In some cases it is necessary to connect/login the user to a provider ? prior to calling the API method. You can learn more in the Social Login guide.