import{r as o,p as i,q as h,w as s,z as e,t as n,R as t}from"./vendor.3d5b4206.js";const d={class:"markdown-body"},p={class:"two-up"},u={class:"left"},_=t("All events that within Directus are tracked and stored in the activities collection. This gives you full accountability over everything that happens. "),m=t("Learn more about Activity"),y=t("."),g=e("div",{class:"right"},[e("p",null,[e("div",{class:"table-of-contents"},[e("ul",null,[e("li",null,[e("a",{href:"#the-activity-object"},"The Activity Object")]),e("li",null,[e("a",{href:"#list-activity-actions"},"List Activity Actions")]),e("li",null,[e("a",{href:"#retrieve-activity-action"},"Retrieve Activity Action")]),e("li",null,[e("a",{href:"#create-a-comment"},"Create a Comment")]),e("li",null,[e("a",{href:"#update-a-comment"},"Update a Comment")]),e("li",null,[e("a",{href:"#delete-a-comment"},"Delete a Comment")])])])])],-1),f=e("hr",null,null,-1),v=e("h2",{id:"the-activity-object"},[t("The Activity Object "),e("a",{class:"header-anchor",href:"#the-activity-object"},"#")],-1),j={class:"two-up"},b={class:"left"},q={class:"definitions"},w=e("p",null,[e("code",null,"action"),t(),e("strong",null,"string"),e("br"),t(" Action that was performed.")],-1),k=e("p",null,[e("code",null,"collection"),t(),e("strong",null,"string"),e("br"),t(" Collection identifier in which the item resides.")],-1),x=e("p",null,[e("code",null,"comment"),t(),e("strong",null,"string"),e("br"),t(" User comment. This will store the comments that show up in the right sidebar of the item edit page in the admin app.")],-1),T=e("p",null,[e("code",null,"id"),t(),e("strong",null,"integer"),e("br"),t(" Unique identifier for the object.")],-1),A=e("p",null,[e("code",null,"ip"),t(),e("strong",null,"string"),e("br"),t(" The IP address of the user at the time the action took place.")],-1),R=e("p",null,[e("code",null,"item"),t(),e("strong",null,"string"),e("br"),t(" Unique identifier for the item the action applied to. This is always a string, even for integer primary keys.")],-1),E=e("p",null,[e("code",null,"timestamp"),t(),e("strong",null,"string"),e("br"),t(" When the action happened.")],-1),S=e("code",null,"user",-1),C=t(),P=e("strong",null,"many-to-one",-1),D=e("br",null,null,-1),I=t(" The user who performed this action. Many-to-one to "),L=t("users"),O=t("."),M=e("p",null,[e("code",null,"user_agent"),t(),e("strong",null,"string"),e("br"),t(" User agent string of the browser the user used when the action took place.")],-1),H=e("code",null,"revisions",-1),Q=t(),G=e("strong",null,"one-to-many",-1),W=e("br",null,null,-1),U=t(" Any changes that were made in this activity. One-to-many to "),B=t("revisions"),V=t("."),K=e("div",{class:"right"},[e("pre",null,[e("code",{class:"language-json"},[t(`{
	`),e("span",{class:"hljs-attr"},'"action"'),t(": "),e("span",{class:"hljs-string"},'"create"'),t(`,
	`),e("span",{class:"hljs-attr"},'"collection"'),t(": "),e("span",{class:"hljs-string"},'"articles"'),t(`,
	`),e("span",{class:"hljs-attr"},'"comment"'),t(": "),e("span",{class:"hljs-literal"},"null"),t(`,
	`),e("span",{class:"hljs-attr"},'"id"'),t(": "),e("span",{class:"hljs-number"},"5"),t(`,
	`),e("span",{class:"hljs-attr"},'"ip"'),t(": "),e("span",{class:"hljs-string"},'"139.178.128.0"'),t(`,
	`),e("span",{class:"hljs-attr"},'"item"'),t(": "),e("span",{class:"hljs-string"},'"1"'),t(`,
	`),e("span",{class:"hljs-attr"},'"timestamp"'),t(": "),e("span",{class:"hljs-string"},'"2021-02-02T12:50:26-05:00"'),t(`,
	`),e("span",{class:"hljs-attr"},'"user"'),t(": "),e("span",{class:"hljs-string"},'"2d321940-69f5-445f-be6b-c773fa58a820"'),t(`,
	`),e("span",{class:"hljs-attr"},'"user_agent"'),t(": "),e("span",{class:"hljs-string"},'"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0.2 Safari/605.1.15"'),t(`,
	`),e("span",{class:"hljs-attr"},'"revisions"'),t(": ["),e("span",{class:"hljs-number"},"4"),t(`]
}
`)])])],-1),N=e("hr",null,null,-1),z=e("h2",{id:"list-activity-actions"},[t("List Activity Actions "),e("a",{class:"header-anchor",href:"#list-activity-actions"},"#")],-1),X=e("p",null,"Returns a list of activity actions.",-1),F={class:"two-up"},J={class:"left"},Y=e("h3",{id:"query-parameters"},[t("Query Parameters "),e("a",{class:"header-anchor",href:"#query-parameters"},"#")],-1),Z=t("Supports all "),$=t("global query parameters"),ee=t("."),te=e("h3",{id:"returns"},[t("Returns "),e("a",{class:"header-anchor",href:"#returns"},"#")],-1),se=t("An array of up to "),ae=t("limit"),ne=t(),le=e("a",{href:"#the-activity-object"},"activity objects",-1),oe=t(". If no items are available, data will be an empty array."),ce={class:"right"},re=e("h3",{id:"rest-api"},[t("REST API "),e("a",{class:"header-anchor",href:"#rest-api"},"#")],-1),ie=e("pre",null,[e("code",null,`GET /activity
SEARCH /activity
`)],-1),he=t("Learn more about SEARCH ->"),de=e("h3",{id:"graphql"},[t("GraphQL "),e("a",{class:"header-anchor",href:"#graphql"},"#")],-1),pe=e("pre",null,[e("code",null,`POST /graphql/system
`)],-1),ue=e("pre",null,[e("code",{class:"language-graphql"},[e("span",{class:"hljs-keyword"},"type"),e("span",{class:"hljs-type"}," Query"),t(` {
	activity: [directus_activity]
}
`)])],-1),_e=e("h5",{id:"example"},[t("Example "),e("a",{class:"header-anchor",href:"#example"},"#")],-1),me=e("pre",null,[e("code",{class:"language-graphql"},[e("span",{class:"hljs-keyword"},"query"),t(` {
	activity {
		`),e("span",{class:"hljs-keyword"},"..."),t(`
	}
}
`)])],-1),ye=e("hr",null,null,-1),ge=e("h2",{id:"retrieve-activity-action"},[t("Retrieve Activity Action "),e("a",{class:"header-anchor",href:"#retrieve-activity-action"},"#")],-1),fe=e("p",null,"Returns a single activity action by primary key.",-1),ve={class:"two-up"},je={class:"left"},be=e("h3",{id:"query-parameters-2"},[t("Query Parameters "),e("a",{class:"header-anchor",href:"#query-parameters-2"},"#")],-1),qe=t("Supports all "),we=t("global query parameters"),ke=t("."),xe=e("h3",{id:"returns-2"},[t("Returns "),e("a",{class:"header-anchor",href:"#returns-2"},"#")],-1),Te=e("p",null,[t("Returns an "),e("a",{href:"#the-activity-object"},"activity object"),t(" if a valid identifier was provided.")],-1),Ae=e("div",{class:"right"},[e("h3",{id:"rest-api-2"},[t("REST API "),e("a",{class:"header-anchor",href:"#rest-api-2"},"#")]),e("pre",null,[e("code",null,`GET /activity/:id
`)]),e("h3",{id:"graphql-2"},[t("GraphQL "),e("a",{class:"header-anchor",href:"#graphql-2"},"#")]),e("pre",null,[e("code",null,`POST /graphql/system
`)]),e("pre",null,[e("code",{class:"language-graphql"},[e("span",{class:"hljs-keyword"},"type"),e("span",{class:"hljs-type"}," Query"),t(` {
	activity_by_id(id:`),e("span",{class:"hljs-literal"}," ID"),t(`!): directus_activity
}
`)])]),e("h5",{id:"example-2"},[t("Example "),e("a",{class:"header-anchor",href:"#example-2"},"#")]),e("pre",null,[e("code",{class:"language-graphql"},[e("span",{class:"hljs-keyword"},"query"),t(` {
	activity_by_id(id: `),e("span",{class:"hljs-number"},"15"),t(`) {
		`),e("span",{class:"hljs-keyword"},"..."),t(`
	}
}
`)])])],-1),Re=e("hr",null,null,-1),Ee=e("h2",{id:"create-a-comment"},[t("Create a Comment "),e("a",{class:"header-anchor",href:"#create-a-comment"},"#")],-1),Se=e("p",null,"Creates a new comment on a given item.",-1),Ce=e("div",{class:"two-up"},[e("div",{class:"left"},[e("h3",{id:"request-body"},[t("Request Body "),e("a",{class:"header-anchor",href:"#request-body"},"#")]),e("div",{class:"definitions"},[e("p",null,[e("code",null,"collection"),t(),e("strong",null,"Required"),e("br"),t(" Collection in which the item resides.")]),e("p",null,[e("code",null,"item"),t(),e("strong",null,"Required"),e("br"),t(" Primary Key of the item to comment on.")]),e("p",null,[e("code",null,"comment"),t(),e("strong",null,"Required"),e("br"),t(" The comment content. Supports Markdown.")])]),e("h3",{id:"returns-3"},[t("Returns "),e("a",{class:"header-anchor",href:"#returns-3"},"#")]),e("p",null,[t("Returns the "),e("a",{href:"#the-activity-object"},"activity object"),t(" of the created comment.")])]),e("div",{class:"right"},[e("h3",{id:"rest-api-3"},[t("REST API "),e("a",{class:"header-anchor",href:"#rest-api-3"},"#")]),e("pre",null,[e("code",null,`POST /activity/comment
`)]),e("h5",{id:"example-3"},[t("Example "),e("a",{class:"header-anchor",href:"#example-3"},"#")]),e("pre",null,[e("code",{class:"language-json"},[e("span",{class:"hljs-comment"},"// POST /activity/comment"),t(`

{
	`),e("span",{class:"hljs-attr"},'"collection"'),t(": "),e("span",{class:"hljs-string"},'"pages"'),t(`,
	`),e("span",{class:"hljs-attr"},'"item"'),t(": "),e("span",{class:"hljs-number"},"3"),t(`,
	`),e("span",{class:"hljs-attr"},'"comment"'),t(": "),e("span",{class:"hljs-string"},'"Hello World"'),t(`
}
`)])]),e("h3",{id:"graphql-3"},[t("GraphQL "),e("a",{class:"header-anchor",href:"#graphql-3"},"#")]),e("pre",null,[e("code",null,`POST /graphql/system
`)]),e("pre",null,[e("code",{class:"language-graphql"},[e("span",{class:"hljs-keyword"},"type"),e("span",{class:"hljs-type"}," Mutation"),t(` {
	create_comment(collection:`),e("span",{class:"hljs-type"}," String"),t("!, item:"),e("span",{class:"hljs-literal"}," ID"),t("!, comment:"),e("span",{class:"hljs-type"}," String"),t(`!): directus_activity
}
`)])]),e("h5",{id:"example-4"},[t("Example "),e("a",{class:"header-anchor",href:"#example-4"},"#")]),e("pre",null,[e("code",{class:"language-graphql"},[e("span",{class:"hljs-keyword"},"mutation"),t(` {
	create_comment(
		collection: `),e("span",{class:"hljs-string"},'"pages"'),t(`,
		item: `),e("span",{class:"hljs-number"},"3"),t(`,
		comment: `),e("span",{class:"hljs-string"},'"Hello World"'),t(`
	) { `),e("span",{class:"hljs-keyword"},"..."),t(` }
}
`)])])])],-1),Pe=e("hr",null,null,-1),De=e("h2",{id:"update-a-comment"},[t("Update a Comment "),e("a",{class:"header-anchor",href:"#update-a-comment"},"#")],-1),Ie=e("p",null,"Updates an existing comment by activity action primary key.",-1),Le=e("div",{class:"two-up"},[e("div",{class:"left"},[e("h3",{id:"request-body-2"},[t("Request Body "),e("a",{class:"header-anchor",href:"#request-body-2"},"#")]),e("div",{class:"definitions"},[e("p",null,[e("code",null,"comment"),t(),e("strong",null,"Required"),e("br"),t(" The updated comment content. Supports Markdown.")])]),e("h3",{id:"returns-4"},[t("Returns "),e("a",{class:"header-anchor",href:"#returns-4"},"#")]),e("p",null,[t("Returns the "),e("a",{href:"#the-activity-object"},"activity object"),t(" of the created comment.")])]),e("div",{class:"right"},[e("h3",{id:"rest-api-4"},[t("REST API "),e("a",{class:"header-anchor",href:"#rest-api-4"},"#")]),e("pre",null,[e("code",null,`PATCH /activity/comment/:id
`)]),e("h5",{id:"example-5"},[t("Example "),e("a",{class:"header-anchor",href:"#example-5"},"#")]),e("pre",null,[e("code",{class:"language-json"},[e("span",{class:"hljs-comment"},"// PATCH /activity/comment/15"),t(`

{
	`),e("span",{class:"hljs-attr"},'"comment"'),t(": "),e("span",{class:"hljs-string"},'"Hello World!!"'),t(`
}
`)])]),e("h3",{id:"graphql-4"},[t("GraphQL "),e("a",{class:"header-anchor",href:"#graphql-4"},"#")]),e("pre",null,[e("code",null,`POST /graphql/system
`)]),e("pre",null,[e("code",{class:"language-graphql"},[e("span",{class:"hljs-keyword"},"type"),e("span",{class:"hljs-type"}," Mutation"),t(` {
	update_comment(id:`),e("span",{class:"hljs-literal"}," ID"),t("!, comment:"),e("span",{class:"hljs-type"}," String"),t(`!): directus_activity
}
`)])]),e("h5",{id:"example-6"},[t("Example "),e("a",{class:"header-anchor",href:"#example-6"},"#")]),e("pre",null,[e("code",{class:"language-graphql"},[e("span",{class:"hljs-keyword"},"mutation"),t(` {
	update_comment(
		id: `),e("span",{class:"hljs-number"},"3"),t(`,
		comment: `),e("span",{class:"hljs-string"},'"Hello World"'),t(`,
	) { `),e("span",{class:"hljs-keyword"},"..."),t(` }
}
`)])])])],-1),Oe=e("hr",null,null,-1),Me=e("h2",{id:"delete-a-comment"},[t("Delete a Comment "),e("a",{class:"header-anchor",href:"#delete-a-comment"},"#")],-1),He=e("p",null,"Deletes a comment.",-1),Qe=e("div",{class:"two-up"},[e("div",{class:"left"}),e("div",{class:"right"},[e("h3",{id:"rest-api-5"},[t("REST API "),e("a",{class:"header-anchor",href:"#rest-api-5"},"#")]),e("pre",null,[e("code",null,`DELETE /activity/comment/:id
`)]),e("h5",{id:"example-7"},[t("Example "),e("a",{class:"header-anchor",href:"#example-7"},"#")]),e("pre",null,[e("code",null,`DELETE /activity/comment/15
`)]),e("h3",{id:"graphql-5"},[t("GraphQL "),e("a",{class:"header-anchor",href:"#graphql-5"},"#")]),e("pre",null,[e("code",null,`POST /graphql/system
`)]),e("pre",null,[e("code",{class:"language-graphql"},[e("span",{class:"hljs-keyword"},"type"),e("span",{class:"hljs-type"}," Mutation"),t(` {
	delete_comment(id:`),e("span",{class:"hljs-literal"}," ID"),t(`): delete_one
}
`)])]),e("h5",{id:"example-8"},[t("Example "),e("a",{class:"header-anchor",href:"#example-8"},"#")]),e("pre",null,[e("code",{class:"language-graphql"},[e("span",{class:"hljs-keyword"},"mutation"),t(` {
	delete_comment(id: `),e("span",{class:"hljs-number"},"3"),t(`) {
		id
	}
}
`)])])])],-1),Ve={setup(Ge,{expose:c}){const l={title:"Activity",modularExtension:!1,pageClass:"page-reference"};return c({frontmatter:l}),(We,Ue)=>{const a=o("router-link"),r=o("DocsWrapper");return i(),h(r,{frontmatter:l},{default:s(()=>[e("div",d,[e("div",p,[e("div",u,[e("blockquote",null,[e("p",null,[_,n(a,{to:"/docs/getting-started/glossary/#activity"},{default:s(()=>[m]),_:1}),y])])]),g]),f,v,e("div",j,[e("div",b,[e("div",q,[w,k,x,T,A,R,E,e("p",null,[S,C,P,D,I,n(a,{to:"/docs/reference/system/users/#the-users-object"},{default:s(()=>[L]),_:1}),O]),M,e("p",null,[H,Q,G,W,U,n(a,{to:"/docs/reference/system/revisions/#the-revisions-object"},{default:s(()=>[B]),_:1}),V])])]),K]),N,z,X,e("div",F,[e("div",J,[Y,e("p",null,[Z,n(a,{to:"/docs/reference/query"},{default:s(()=>[$]),_:1}),ee]),te,e("p",null,[se,n(a,{to:"/docs/reference/query/#limit"},{default:s(()=>[ae]),_:1}),ne,le,oe])]),e("div",ce,[re,ie,e("p",null,[n(a,{to:"/docs/reference/introduction/#search-http-method"},{default:s(()=>[he]),_:1})]),de,pe,ue,_e,me])]),ye,ge,fe,e("div",ve,[e("div",je,[be,e("p",null,[qe,n(a,{to:"/docs/reference/query"},{default:s(()=>[we]),_:1}),ke]),xe,Te]),Ae]),Re,Ee,Se,Ce,Pe,De,Ie,Le,Oe,Me,He,Qe])]),_:1})}}};export{Ve as default};
