logo

Retrieving Business Record Templates

This interface is used to retrieve all business record templates under a company.

Request Method

get notes/note_template

Request Parameters

None

Return Data

AttributeTypeDescription
codeIntegerExecution result code, 1000 represents success
note_templateArrayTemplate content, structure as follows
  • note_template data structure
AttributeTypeDescription
idIntegerBusiness record template ID
nameStringBusiness record template name
descStringDescription of the business record template
categoryStringType of the business record template
custom_fieldsArrayCustom fields under the business record template
ticket_template_idIntegerService ticket template ID
updated_atDatetimeLast update time of the business record template
  • custom_fields data structure
AttributeTypeDescription
field_idIntegerCustom field ID
field_typeStringType of the custom field
nameStringName of the custom field
commentStringDescription of the custom field
is_requiredBooleanWhether it is required

Example

Request

curl https://demo.udesk.cn/open_api_v1/notes/note_template?email=admin@udesk.cn&timestamp=1494474404&sign=6892f1b794071c260e1b1eac15df588fc919c9e86eb742affaa742ad6c03cb52&nonce=2d931510-d99f-494a-8c67-87feb05e1594&sign_version=v2

Response

{
    "code": 1000,
    "note_template": [
        {
            "id": 1,
            "name": "IM Business Record",
            "desc": "Applied to customer service for organizing and recording IM conversation content",
            "category": "im",
            "ticket_template_id": 1,
            "updated_at": "2017-08-18T12:06:02.000+08:00",
            "custom_fields": [
                {
                    "field_id": 3,
                    "field_type": "TextField",
                    "name": "TextField_3",
                    "comment": null,
                    "owner": "Ticket",
                    "is_required": true
                },
                {
                    "field_id": 14,
                    "field_type": "TextField",
                    "name": "TextField_14",
                    "comment": "Developed",
                    "owner": "Ticket",
                    "is_required": false
                },
                {
                    "field_id": 40,
                    "field_type": "TextField",
                    "name": "TextField_40",
                    "comment": null,
                    "owner": "Ticket",
                    "is_required": false
                },
                {
                    "field_id": 5,
                    "field_type": "SelectField",
                    "name": "SelectField_5",
                    "comment": null,
                    "owner": "Ticket",
                    "is_required": false
                },
                {
                    "field_id": 17,
                    "field_type": "TextField",
                    "name": "TextField_17",
                    "comment": null,
                    "owner": "Ticket",
                    "is_required": false
                }
            ]
        },
        {
            "id": 2,
            "name": "Call center business records",
            "desc": "Applied to customer service for sorting and recording call center call records",
            "category": "call",
            "ticket_template_id": 1,
            "updated_at": "2017-08-18T12:06:02.000+08:00",
            "custom_fields": []
        }
    ]
}

Modify Business Record Template

This interface is used to modify the content of the business record template.

Request Method

post notes/update_note_template

Request Parameters (request body)

AttributeRequiredTypeDescriptionRestrictions
idNoIntegerID of the business template
categoryNoIntegerType of business template
ticket_template_idNoIntegerID of the ticket template
custom_fieldsNoArrayTypes of custom fields
  • Notes:
  • Either id or category must be provided and cannot be empty, but they cannot be provided simultaneously.
  • The value of category can be "im" or "call".
  • If only id is provided, the business record template corresponding to the id will be returned and the update time will be modified.
  • If only category is provided, the business record template corresponding to the category will be returned and the update time will be modified.

Example

Request

curl https://demo.udesk.cn/open_api_v1/notes/update_note_template?email=admin@udesk.cn&timestamp=1494474404&sign=6892f1b794071c260e1b1eac15df588fc919c9e86eb742affaa742ad6c03cb52&nonce=2d931510-d99f-494a-8c67-87feb05e1594&sign_version=v2 \
-X POST \
-H 'content-type:application/json' \
-d '{
  "id":"1",
    "ticket_template_id": 30002,
    "custom_fields":  [
       {"field_id":3, "field_type":"TextField", "is_required":true},
     {"field_id":14, "field_type":"TextField", "is_required":false},
     {"field_id":40, "field_type":"TextField", "is_required":false},
     {"field_id":17, "field_type":"TextField", "is_required":false},
     {"field_id":5, "field_type":"SelectField", "is_required":false},
     {"field_id":41, "field_type":"TextField", "is_required":true}
   ]
}'

Response

{
    "code": 1000,
    "ticket_template_id":30002,
    "note_template": {
        "id": 1,
        "name": "IM Business Record",
        "desc": "Used for customer service to organize and record IM conversation content",
        "category": "im",
        "ticket_template_id": 30002,
        "custom_fields": [
            {
                "field_id": 3,
                "field_type": "TextField",
                "name": "TextField_3",
                "comment": null,
                "is_required": true
            },
            {
                "field_id": 14,
                "field_type": "TextField",
                "name": "TextField_14",
                "comment": "Developed",
                "is_required": false
            },
            {
                "field_id": 40,
                "field_type": "TextField",
                "name": "TextField_40",
                "comment": null,
                "is_required": false
            },
            {
                "field_id": 17,
                "field_type": "TextField",
                "name": "TextField_17",
                "comment": null,
                "is_required": false
            },
            {
                "field_id": 5,
                "field_type": "SelectField",
                "name": "SelectField_5",
                "comment": null,
                "is_required": false
            },
            {
                "field_id": 41,
                "field_type": "TextField",
                "name": "TextField_41",
                "comment": null,
                "is_required": true
            }
        ]
    }
}

Retrieve Business Record List

This interface is used to obtain a list of business records that meet certain conditions.

Request Method

get /notes

Request Parameters (query string)

AttributeRequiredTypeDescriptionRestrictions
start_dateNoDateTimeStart date of the business records
end_dateNoDateTimeEnd date of the business records
categoryNoStringType of business records, either "im" or "call"
pageNoIntegerCurrent page, default is 1
per_pageNoIntegerNumber of records per page, range 1~50, default is 20
  • Notes:
  • Obtains business records created between start_date and end_date, defaults to the current day, can retrieve data within one year, formatted as year-month-day (2017-09-10).
  • If the provided page parameter format is incorrect, the parameter is not parsed, and the default value of 1 is used.

Response Data

AttributeTypeDescription
codeIntegerExecution result code, 1000 for success
note_recordArrayBusiness records
metaObjectPagination related content
  • Data structure of note_record
AttributeTypeDescription
idIntegerBusiness record ID
contentStringContent
agent_idIntegerAgent ID
agent_nick_nameStringAgent nickname
customer_idIntegerCustomer ID
customer_nick_nameStringCustomer nickname
custom_fieldsArrayCustom fields
created_atDateTimeCreation time of the record
last_editor_idIntegerID of the last editor
last_editor_nick_nameStringNickname of the last editor
categoryStringType of business record
session_idIntegerAssociated ID
session_typeStringType of session
updated_atDateTimeLast update time of the record

Example

Request

curl https://demo.udesk.cn/open_api_v1/notes?email=admin@udesk.cn&timestamp=1494474404&sign=6892f1b794071c260e1b1eac15df588fc919c9e86eb742affaa742ad6c03cb52&nonce=2d931510-d99f-494a-8c67-87feb05e1594&sign_version=v2

Response

{
    "code": 1000,
    "note_record": [
        {
            "id": 3,
            "content": "NULL",
            "category": "im",
            "custom_fields": {
                "SelectField_2": "1"
            },
            "created_at": "2017-01-17T14:14:55.000+08:00",
            "updated_at": "2017-01-17T14:14:55.000+08:00",
            "customer_id": 1014,
            "customer_nick_name": null,
            "agent_id": 1,
            "agent_nick_name": "alalla",
            "last_editor_id": 1,
            "last_editor_nick_name": "alalla",
            "session_id": 2,
            "session_type": "ImSubSession",
            "agent_note_template_id": 6
        },
        {
            "id": 2,
            "content": "NULL",
            "category": "im",
            "custom_fields": {
                "TextField_3": "2017-01-19"
            },
            "created_at": "2017-01-17T14:14:51.000+08:00",
            "updated_at": "2017-01-17T14:14:51.000+08:00",
            "customer_id": 1014,
            "customer_nick_name": null,
            "agent_id": 1,
            "agent_nick_name": "alalla",
            "last_editor_id": 1,
            "last_editor_nick_name": "alalla",
            "session_id": 4,
            "session_type": "ImSubSession",
            "agent_note_template_id": 3
        },
        {
            "id": 1,
            "content": "subject",
            "category": "im",
            "custom_fields": {
                "TextField_3": "2017-01-25",
                "TextField_4": "23:58:59",
                "TextField_5": "12313",
                "TextField_6": "2343243",
                "TextField_7": "https://demo.udesk.cn/entry/analysis/im/record",
                "SelectField_2": "0",
                "SelectField_3": "0,0,0",
                "SelectField_5": "0,1,2"
            },
            "created_at": "2017-01-17T14:13:41.000+08:00",
            "updated_at": "2017-01-17T14:13:41.000+08:00",
            "customer_id": 1014,
            "customer_nick_name": null,
            "agent_id": 1,
            "agent_nick_name": "alalla",
            "last_editor_id": 1,
            "last_editor_nick_name": "alalla",
            "session_id": 5,
            "session_type": "ImSubSession",
            "agent_note_template_id": 2
        }
    ],
    "meta": {
        "current_page": 1,
        "total_pages": 1,
        "total_records": 3
    }
}

Retrieve a Specific Business Record Detail

This interface is used to obtain a specific business record that meets certain conditions.

Request Method

get /notes/detail

Request Parameters (query string)

AttributeRequiredTypeDescriptionRestrictions
note_idNoIntegerID of the business record
categoryNoStringType of the business record
session_idNoIntegerAssociated ID
  • Notes: There are two ways to obtain results
  • One is to query directly based on the provided note_id; just provide note_id.
  • The other is to query based on category combined with session_id; both category and session_id must be provided simultaneously and cannot be empty.
  • The three values cannot be provided at the same time.

Response Data

AttributeTypeDescription
codeIntegerExecution result code, 1000 for success
note_recordObjectBusiness record
  • Data structure of note_record
AttributeTypeDescription
idIntegerBusiness record ID
contentStringSubject of the record
agent_idIntegerAgent ID
agent_nick_nameStringAgent nickname
customer_idIntegerCustomer ID
customer_nick_nameStringCustomer nickname
custom_fieldsArrayCustom fields
created_atDateTimeCreation time of the record
updated_atDateTimeLast update time of the record
last_editor_idIntegerID of the last editor
last_editor_nick_nameStringNickname of the last editor
categoryStringType of business record
session_idIntegerAssociated ID
session_typeStringType of session

Example

Request

curl https://demo.udesk.cn/open_api_v1/notes/detail?email=admin@udesk.cn&timestamp=1494474404&sign=6892f1b794071c260e1b1eac15df588fc919c9e86eb742affaa742ad6c03cb52&nonce=2d931510-d99f-494a-8c67-87feb05e1594&sign_version=v2&note_id=1

Response

{
    "code": 1000,
    "note_record": {
        "id": 1,
        "content": "subject",
        "category": "im",
        "custom_fields": {
            "TextField_3": "2017-01-25",
            "TextField_4": "23:58:59",
            "TextField_5": "12313",
            "TextField_6": "2343243",
            "TextField_7": "https://demo.udesk.cn/entry/analysis/im/record",
            "SelectField_2": "0",
            "SelectField_3": "0,0,0",
            "SelectField_5": "0,1,2"
        },
        "created_at": "2017-01-17T14:13:41.000+08:00",
        "updated_at": "2017-01-17T14:13:41.000+08:00",
        "customer_id": 1014,
        "customer_nick_name": null,
        "agent_id": 1,
        "agent_nick_name": "alalla",
        "last_editor_id": 1,
        "last_editor_nick_name": "alalla",
        "session_id": 5,
        "session_type": "ImSubSession",
        "agent_note_template_id": 2
    }
}

Modify Business Record

This interface is used to modify a specific business record.

Request Method

put /notes/:id

Request Parameters (request body)

AttributeRequiredTypeDescriptionRestrictions
noteYesObjectContent of the business record

The data structure of note is as follows

AttributeRequiredTypeDescriptionRestrictions
contentNoStringSubject of the record
last_editor_idNoIntegerID of the last editor
custom_fieldsNoObjectCustom fields

Response Data

AttributeTypeDescription
codeIntegerExecution result code, 1000 for success
note_recordObjectBusiness record

The data structure of note_record is as follows

AttributeTypeDescription
idIntegerBusiness record ID
contentStringSubject of the record
agent_idIntegerAgent ID
agent_nick_nameStringAgent nickname
customer_idIntegerCustomer ID
customer_nick_nameStringCustomer nickname
custom_fieldsArrayCustom fields
created_atDateTimeCreation time of the record
last_editor_idIntegerID of the last editor
last_editor_nick_nameStringNickname of the last editor
categoryStringType of business record
session_idIntegerAssociated ID
session_typeStringType of session

Example

Request

curl https://demo.udesk.cn/open_api_v1/notes/1?email=admin@udesk.cn&timestamp=1494474404&sign=6892f1b794071c260e1b1eac15df588fc919c9e86eb742affaa742ad6c03cb52&nonce=2d931510-d99f-494a-8c67-87feb05e1594&sign_version=v2 \
-X PUT \
-H 'content-type:application/json' \
-d '{
  "content": "Modify Business Record",
  "custom_fields" : {
      "TextField_3": "2017-01-25",
        "TextField_4": "23:58:59",
        "TextField_5": "12313",
        "TextField_6": "2343243",
        "TextField_7": "https://demo.udesk.cn/entry/analysis/im/record",
        "SelectField_2": "0",
        "SelectField_3": "0,0,0",
        "SelectField_5": "0,1,2"
  }
}'

Response

{
    "code": 1000,
    "note_record": {
        "id": 1,
        "content": "Modify Business Record",
        "category": "im",
        "custom_fields": {
            "TextField_3": "2017-01-25",
            "TextField_4": "23:58:59",
            "TextField_5": "12313",
            "TextField_6": "2343243",
            "TextField_7": "https://demo.udesk.cn/entry/analysis/im/record",
            "SelectField_2": "0",
            "SelectField_3": "0,0,0",
            "SelectField_5": "0,1,2"
        },
        "created_at": "2017-01-17T14:13:41.000+08:00",
        "customer_id": 1014,
        "customer_nick_name": null,
        "agent_id": 1,
        "agent_nick_name": "alalla",
        "last_editor_id": 1,
        "last_editor_nick_name": "alalla",
        "session_id": 5,
        "session_type": "ImSubSession"
    }
}

Business Record Change

This interface is used to create or modify business records.

Request Method

post /notes

Request Parameters

AttributeRequiredTypeDescriptionRestrictions
categoryYesStringType of business record, im/call
session_idYesIntegerBusiness record associated ID
noteYesObjectContent of the business record
  • The data structure of note is as follows
AttributeRequiredTypeDescriptionRestrictions
agent_idYesIntegerAgent ID
customer_idYesIntegerCustomer ID
session_idYesIntegerBusiness record corresponding session_id
session_typeYesStringType corresponding to the business record
contentYesStringDetailed content of the business record
last_editor_idYesIntegerID of the last editor
custom_fieldsYesObjectCustom fields

Response Data

AttributeTypeDescription
codeIntegerExecution result code, 1000 for success
note_recordObjectBusiness record
  • The data structure of note_record is as follows
AttributeTypeDescription
idIntegerBusiness record ID
contentStringSubject of the record
agent_idIntegerAgent ID
agent_nick_nameStringAgent nickname
customer_idIntegerCustomer ID
customer_nick_nameStringCustomer nickname
custom_fieldsArrayCustom fields
created_atDateTimeCreation time of the record
last_editor_idIntegerID of the last editor
last_editor_nick_nameStringNickname of the last editor
categoryStringType of business record
session_idIntegerAssociated ID
session_typeStringType of session

Example

Request

curl https://demo.udesk.cn/open_api_v1/notes?email=admin@udesk.cn&timestamp=1494474404&sign=6892f1b794071c260e1b1eac15df588fc919c9e86eb742affaa742ad6c03cb52&nonce=2d931510-d99f-494a-8c67-87feb05e1594&sign_version=v2 \
-X POST \
-H 'content-type:application/json' \
-d '{
    "category": "im",
    "session_id": 5,
    "note": {
        "content": "Modify Business Record",
        "agent_id": 1,
        "customer_id": 1014,
        "session_id": 5,
        "session_type": "ImSubSession",
        "last_editor_id": 1,
        "custom_fields": {
            "TextField_3": "2017-01-25",
            "TextField_4": "23:58:59",
            "TextField_5": "12313",
            "TextField_6": "2343243",
            "TextField_7": "https://demo.udesk.cn/entry/analysis/im/record",
            "SelectField_2": "0",
            "SelectField_3": "0,0,0",
            "SelectField_5": "0,1,2"
        }
    }
}'

Response

{
    "code": 1000,
    "note_record": {
        "id": 1,
        "content": "Modify Business Record",
        "category": "im",
        "custom_fields": {
            "TextField_3": "2017-01-25",
            "TextField_4": "23:58:59",
            "TextField_5": "12313",
            "TextField_6": "2343243",
            "TextField_7": "https://demo.udesk.cn/entry/analysis/im/record",
            "SelectField_2": "0",
            "SelectField_3": "0,0,0",
            "SelectField_5": "0,1,2"
        },
        "created_at": "2017-01-17T14:13:41.000+08:00",
        "customer_id": 1014,
        "customer_nick_name": null,
        "agent_id": 1,
        "agent_nick_name": "alalla",
        "last_editor_id": 1,
        "last_editor_nick_name": "alalla",
        "session_id": 5,
        "session_type": "ImSubSession"
    }
}

Error Codes

Error CodeMessageException: MessageDescription
2000Unknown errorSorry, id and category must be provided with one of them and the value cannot be emptyid and category must be provided with one of them and the value cannot be empty
Unknown errorVerification failed: Ticket template cannot be emptyTicket template is empty or does not exist
Unknown errorper_page's range is 1~50per_page's range is 1~50
Unknown errorSorry, the resource does not existCannot find the resource corresponding to the provided id, it may not exist or the format of the id is incorrect
Unknown errorcategory, session_id must be provided simultaneously and cannot be emptycategory, session_id must be provided simultaneously and cannot be empty
Unknown errorunexist params typeThe value range of category is im or call
Unknown errorThe customer corresponding to last_editor_id does not existThe customer corresponding to last_editor_id does not exist
2005Resource not foundActiveRecord::RecordNotFoundCannot find the resource corresponding to the provided id, it may not exist or the format of the id is incorrect
Resource not foundCouldn't find ImSubSession with 'id'=xxx WHERE im_sub_sessions.company_id = ?Cannot find the resource corresponding to category and session_id
2015Non-administrator cannot perform operationsNon-administrator cannot perform operationsThe email used to call the interface must be an administrator email, non-administrators cannot perform operations
2059Open API signature is incorrectOpen API signature is incorrectOpen API signature is incorrect, refer to the Authentication section of the documentation for details