Getting a Record Instance

In the following example, an instance of the customer record type created in the previous section is retrieved. You can get a particular customer instance by sending a request in the following form: /services/rest/record/v1/customer/<id>. In the following example, the id of the newly created record is 107. You can read the record instance using the following request.

          GET https://demo123.suitetalk.api.netsuite.com/services/rest/record/v1/customer/107 

        

The following is an excerpt from the response headers of a successful operation, returned with HTTP Code 200.

          Date Thu, 14 Feb 2019 14:05:27 GMT
Content-Length 6246
Content-Type application/vnd.oracle.resource+json; type=singular 

        

The following is a shortened example of the body of the response.

          {
    "links": [
        {
            "rel": "self",
            "href": "http://demo123.suitetalk.api.netsuite.com/services/rest/record/v1/customer/107"
        }
    ],
    "accessRole": {
        "links": [
            {
                "rel": "self",
                "href": "http://demo123.suitetalk.api.netsuite.com/services/rest/record/v1/"
            }
        ],
        "id": "14",
        "refName": "Customer Center"
    },
    "accessTabChanged": false,
    "addressbook": {
        "links": [
            {
                "rel": "self",
                "href": "http://demo123.suitetalk.api.netsuite.com/services/rest/record/v1/customer/107/addressbook"
            }
        ]
    },
    "autoName": true,
    "balance": 0,
    "billPay": false,
    "bulkmerge": {
        "links": [
            {
                "rel": "self",
                "href": "http://demo123.suitetalk.api.netsuite.com/services/rest/record/v1/customer/107/bulkmerge"
            }
        ]
    }, 

        

In the following example, an instance of a custom record type is retrieved. You can get a particular custom record type instance by sending a request in the following format, using the script ID of the custom record type: /services/rest/record/v1/customrecord_api_rest/<id>. In the following example, the internal ID of the custom record type instance is 123. You can read the record instance using the following request.

          GET https://demo123.suitetalk.api.netsuite.com/services/rest/record/v1/customrecord_api_rest/123 

        

The response is in a format that conforms to the Swagger and JSON schema. You can validate the retrieved data against the JSON Schema. For information about validation, see Working with JSON Schema Metadata.

In the response, note the Hypermedia As The Engine Of Application State (HATEOAS) links elements. Using the links elements, you can navigate through the REST endpoint.

Getting Body Fields on a Record Instance

You can also retrieve specific body fields of a record by using the GET method.

You can use a request similar to the following URL with parameter fields to specify the list of fields you want to retrieve:

            GET https://demo123.suitetalk.api.netsuite.com/services/rest/record/v1/customer/107?fields=companyName,email,entityId 

          

The response contains only the fields you specify in the request.

            {
    "links": [
        {
            "rel": "self",
            "href": "https://demo123.suitetalk.api.netsuite.com/services/rest/record/v1/customer/107?fields=companyName%2Cemail%2CentityId"
        }
    ],
    "companyName": "Glenrock General Hospital",
    "email": "alan.rath@ns.com",
    "entityId": "Alan Rath"
} 

          

You can selectively retrieve body fields from a record instance, but the selective retrieval of sublist and subrecord fields is not supported.

Related Topics

The REST API Browser
NetSuite Record Structure
Using CRUD Operations on Custom Records, Custom Lists, and Custom Transactions v1
Creating a Record Instance
Updating a Record Instance
Using the Upsert Operation
Deleting a Record Instance
Accessing Subresources in REST Web Services
Using External IDs
Using Datetime Fields
Executing Record Actions
Transforming Records
Working with the Pricing Sublist on Item Records
Using the REST Web Services SuiteScript Execution Context

General Notices