Save Object

The Save API is a versatile endpoint used to create or update data objects within the Nirvahak platform. This API works across multiple modules like Appointments, Orders, Users, and more by passing structured data in the request.

The save API is typically used after authentication and is called via JSONP to support frontend frameworks like Angular.

API Endpoint

POST https://server.nirvahak.com/studio/jsonp/save

Request Structure

The request is sent as a JSON object in the query parameters (JSONP), and should include:-

  • objectName
  • applicationCode
  • organizationCode
  • data (actual data to be saved)
  • apiToken
  • callback

Parameter Breakdown

ParameterTypeRequiredDescription
objectNameStringYesFully qualified object name to save (e.g., com.tsb.services.studio.Appointment)
dataObjectYesActual content/data to be saved
apiTokenStringYesAuthorization token returned after login
applicationCodeStringYesApplication identifier (e.g., studio)
organizationCodeStringYesOrganization code from login or org fetch
callbackStringYesJSONP callback function name (used by Angular HTTP JSONP)

API Call

POST https://server.nirvahak.com/studio/jsonp/save?callback=ng_jsonp_callback_1

Request Body (Sent as JSONP Data):

{
  "objectName": "com.tsb.services.studio.Appointment",
  "applicationCode": "studio",
  "organizationCode": "xyz",
  "apiToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
  "data": {
    "name": "Joe",
    "email": "joe@example.com",
    "mobileNo": "9999999999",
    "date": "2025-07-01",
    "location": "Hyderabad"
  }
}

Success Response

{
  "status": "success",
  "message": "Object saved successfully",
  "savedObjectId": "APT12345"
}

Error Response

{
  "status": "error",
  "message": "Invalid token or missing fields",
  "error_code": "SAVE_ERR_401"
}

Next

Leave a Reply

Your email address will not be published. Required fields are marked *