Referenced Objects and Expansion
You can expand objects referenced by internal ID in the main response elements (data array), if the referenced object type supports expansion. It can be used to return additional data in the same response without the need for separate requests. Some of this additional data is only available when using expansion.
If there are any attributes available for expansion in the main response elements (data array), the response automatically includes a relationships property in the response metadata (meta object) with information about the attributes available for expansion and the referenced objects (object type and internal ID).
To include the expanded objects in your response, use the expand query parameter. The JSON-encoded object returned will include the included property, an array of expanded objects.
For information about available expansions and supported object types, see Available Expansions and Supported Object Types.
Parameters
|
Parameter |
Description |
|---|---|
|
|
A comma-separated list of attributes available for expansion. The comma-separated list may include spaces (or
Note:
Review the following:
|
Response
An expanded response includes the meta and included properties in the JSON-encoded object returned.
The main response element (data array) must include resource objects with attributes available for expansions for the following properties to be returned. Referenced objects metadata and expanded objects can be included in responses to GET request used to retrieve a list of objects or a single object, or in responses to PUT and POST requests if the return_object query parameter is set to any value other than 0 (zero).
|
Property |
Description |
|---|---|
|
|
The response metadata object includes a The Each object in the
The key-value pair is omitted if there are no referenced objects (if the internal ID of the referenced object is The response metadata object also includes a |
|
|
An array of expanded objects. The objects in the
Each expanded object in the The number of expanded objects that can be returned in the
Note:
To review your requirements, and increase the maximum number of expanded objects that can be returned by a single REST API request, contact SuiteProjects Pro Support. Note that there will be a performance trade off if the maximum number of expanded object is increased. |
Example
The following request returns the list of attachments associated with the receipt with the internal ID 467 with expansions for the lockedBy, uploadedBy and workspaceId attributes.
GET /rest/v1/receipts/467/attachments?expand=lockedBy,uploadedBy,workspaceId
The response includes the following properties:
-
meta— the response metadata includesrelationshipsinformation about the attributes available for expansion (uploadedByandworkspaceId) and the referenced object internal IDs and types (userDisplayNameandworkspace, respectively). ThelockedByattribute is omitted as the referenced object internal ID is0for all the main response elements in thedataarray (no referenced objects). -
included— an array of expandeduserDisplayNameandworkspaceobjects.
{
"included": [
{
"data": {
"id": 12,
"displayName": "Marc Collins"
},
"type": "userDisplayName"
},
{
"data": {
"created": "2020-12-10 08:09:21",
"name": "Altima Technology",
"updated": "2020-12-10 08:09:21",
"id": 103
},
"type": "workspace"
}
"data" : [
{
"workspaceId": 103
"isFolder": false,
"fileName": "receipt1.jpg",
"name": "receipt1.jpg",
"isLocked": false,
"uploadedBy": 12,
"lockedBy": 0,
"isExcludedFromAlert": false,
"size": 17762,
"attachmentCategoryId": 0,
"created": "2020-12-13 07:01:00",
"notes": "",
"updated": "2020-12-13 07:01:00",
"id": 1056,
"fileType": "JPEG image data, JFIF standard 1.00, comment: \"LEAD Technologies Inc. V1.01\""
}
],
"message" : "success",
"meta": {
"relationships": [
{
"uploadedBy": {
"data": { "type": "userDisplayName", "id": 12 }
},
"workspaceId": {
"data": { "type": "workspace", "id": 103 }
}
},
],
"rowsPerPage": 100,
"totalPages": 1,
"totalRows": 1,
"links": [
{
"rel": "self",
"href": "https://company-id.app.netsuitesuiteprojectspro.com/rest/v1/receipts/467/attachments?expand=lockedBy,workspaceId,uploadedBy"
}
]
}
}
Available Expansions and Supported Object Types
The following object types support expansion:
-
attachment— See Attachment object properties. -
attachmentCategory— TheattachmentCategoryobject type is available only as an expanded object and has the following attributes:Property
Description
Type
idThe unique internal identifier of the attachment category.
integer($int64)
displayNameThe display name of the attachment category.
string
-
bookingTypeDisplayName— ThebookingTypeDisplayNameobject type is available only as an expanded object and has the following attributes:Property
Description
Type
idThe unique internal identifier of the booking type.
integer($int64)
displayNameThe display name of the booking type.
string
-
itemDisplayName— TheitemDisplayNameobject type is available only as an expanded object and has the following attributes:Property
Description
Type
idThe unique internal identifier of the expense item.
integer($int64)
displayNameThe display name of the expense item.
string
-
jobCodeDisplayName— ThejobCodeDisplayNameobject type is available only as an expanded object and has the following attributes:Property
Description
Type
idThe unique internal identifier of the booking type.
integer($int64)
displayNameThe display name of the booking type.
string
-
projectStageName— TheprojectStageNameobject type is available only as an expanded object and has the following attributes:Property
Description
Type
idThe unique internal identifier of the project stage.
integer($int64)
nameThe name of the project stage.
string
-
projectGroupDisplayName— TheprojectGroupDisplayNameobject type is available only as an expanded object and has the following attributes:Property
Description
Type
idThe unique internal identifier of the assignment group.
integer($int64)
displayNameThe display name of the assignment group.
string
-
userDisplayName— TheuserDisplayNameobject type is available only as an expanded object and has the following attributes:Property
Description
Type
idThe unique internal identifier of the user.
integer($int64)
displayNameThe display name of the user.
string
-
workspace— Theworkspaceobject type is available only as an expanded object and has the following attributes:Property
Description
Type
createdThe date the workspace was created.
string($date-time)
idThe unique internal identifier of the workspace.
integer($int64)
nameThe name of the workspace.
string
updatedThe date the workspace was last updated or modified.
string($date-time)
The following table lists the main response attributes available for expansion:
|
Main response object |
Attribute |
Referenced object type |
Description |
|---|---|---|---|
|
Attachment |
|
|
Returns the display name of the attachment category. |
|
Attachment |
|
|
Returns the display name of the employee who locked the attachment for editing. |
|
Attachment |
|
|
Returns the display name of the employee who uploaded the attachment file. |
|
Attachment |
|
|
Returns the workspace the attachment is associated with, if the attachment is a workspace document. |
|
Booking |
|
|
Returns the metadata for all attachments associated with the booking. |
|
Booking |
|
|
Returns the display name of the booking type. |
|
Booking |
|
|
Returns the display name of the job code associated with the booking. |
|
Booking |
|
|
Returns the display name of the employee who created the booking. |
|
Booking |
|
|
Returns the display name of the employee associated with the booking — the resource booked. |
|
Customer |
|
|
Returns the display name of the employee. |
|
ExpenseReport |
|
|
Returns the metadata for all attachments associated with the expense report. |
|
ExpenseReport |
|
|
Returns the display name of the employee associated with the expense report. |
|
Project |
|
|
Returns the metadata for all attachments associated with the project. |
|
Project |
|
|
Returns the display name of the employee. |
|
Project |
|
|
Returns the name of the project stage. |
|
Project |
|
|
Returns the metadata for all attachments associated with the project milestone, phase, or task. |
|
ProjectTask |
|
|
Returns the name of the project assignment group. |
|
Receipt |
|
|
Returns the metadata for all attachments associated with the receipt. |
|
Receipt |
|
|
Returns the display name of the expense item associated with the receipt. |
|
Receipt |
|
|
Returns the display name of the employee associated with the receipt. |
|
TimeEntry |
|
|
Returns the display name of the job code associated with the time entry. |
|
TimeEntry |
|
|
Returns the display name of the employee associated with the time entry. |
|
User |
|
|
Returns the metadata for the attachment associated with the user. |
|
User |
|
|
Returns the display name of the employee. |
|
User |
|
|
Returns the display name of the job code associated with the user. |