AdminNotesResource
This class is used to send requests to Admin Note API Routes. All its method
are available in the JS Client under the medusa.admin.notes
property.
All methods in this class require user authentication.
Notes are created by admins and can be associated with any resource. For example, an admin can add a note to an order for additional details or remarks.
Methods
create
Create a Note which can be associated with any resource.
Example
import Medusa from "@medusajs/medusa-js"
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
// must be previously logged in or use api token
medusa.admin.notes.create({
resource_id,
resource_type: "order",
value: "We delivered this order"
})
.then(({ note }) => {
console.log(note.id);
})
Parameters
The note to be created.
customHeaders
Record<string, any>RequiredDefault: {}
Returns
ResponsePromise
ResponsePromise<AdminNotesRes>RequiredResolves to the note's details.
ResponsePromise
ResponsePromise<AdminNotesRes>Requiredupdate
Update a Note's details.
Example
Parameters
id
stringRequiredThe attributes to update in the note.
customHeaders
Record<string, any>RequiredDefault: {}
Returns
ResponsePromise
ResponsePromise<AdminNotesRes>RequiredResolves to the note's details.
ResponsePromise
ResponsePromise<AdminNotesRes>Requireddelete
Delete a Note.
Example
Parameters
id
stringRequiredcustomHeaders
Record<string, any>RequiredDefault: {}
Returns
ResponsePromise
ResponsePromise<DeleteResponse>RequiredResolves to the deletion operation's details.
ResponsePromise
ResponsePromise<DeleteResponse>Requiredretrieve
Retrieve a note's details.
Example
Parameters
id
stringRequiredcustomHeaders
Record<string, any>RequiredDefault: {}
Returns
ResponsePromise
ResponsePromise<AdminNotesRes>RequiredResolves to the note's details.
ResponsePromise
ResponsePromise<AdminNotesRes>Requiredlist
Retrieve a list of notes. The notes can be filtered by fields such as resource_id
passed in the query
parameter. The notes can also be paginated.
Example
To list notes:
By default, only the first 50
records are retrieved. You can control pagination by specifying the limit
and offset
properties:
Parameters
customHeaders
Record<string, any>RequiredDefault: {}
query
AdminGetNotesParamsFilters and pagination configurations applied on retrieved notes.
query
AdminGetNotesParamsReturns
ResponsePromise
ResponsePromise<AdminNotesListRes>RequiredResolves to the list of notes with pagination fields.
ResponsePromise
ResponsePromise<AdminNotesListRes>Required