Skip to content

Latest commit

 

History

History
108 lines (100 loc) · 2.59 KB

search.md

File metadata and controls

108 lines (100 loc) · 2.59 KB

Search

Search for Content

To get a list of items matching a search query, call the search.query(searchQuery, options, callback) method. There are many possible options for advanced search filtering, which are documented in the Search API Reference.

// Search for PDF or Word documents matching "Mobile"
client.search.query(
	'Mobile',
	{
		fields: 'name,modified_at,size,extension,permissions,sync_state',
		file_extensions: 'pdf,doc',
		limit: 200,
		offset: 0
	})
	.then(results => {
		/* results -> {
			total_count: 1,
			entries: 
			[ { type: 'file',
				id: '11111',
				sequence_id: '1',
				etag: '1',
				sha1: 'f89d97c5eea0a68e2cec911s932eca34a52355d2',
				name: 'Box for Sales - Empowering Your Mobile Worker White paper 2pg (External).pdf',
				description: '',
				size: 408979,
				path_collection: 
					{ total_count: 2,
					entries: 
					[ { type: 'folder',
						id: '0',
						sequence_id: null,
						etag: null,
						name: 'All Files' },
						{ type: 'folder',
						id: '22222',
						sequence_id: '1',
						etag: '1',
						name: 'Marketing Active Work' } ] },
				created_at: '2014-05-17T12:59:45-07:00',
				modified_at: '2014-05-17T13:00:20-07:00',
				trashed_at: null,
				purged_at: null,
				content_created_at: '2014-05-17T12:58:58-07:00',
				content_modified_at: '2014-05-17T12:58:58-07:00',
				created_by: 
					{ type: 'user',
					id: '33333',
					name: 'Example User',
					login: '[email protected]' },
				modified_by: 
					{ type: 'user',
					id: '33333',
					name: 'Example User',
					login: '[email protected]' },
				owned_by: 
					{ type: 'user',
					id: '33333',
					name: 'Example User',
					login: '[email protected]' },
				shared_link: null,
				parent: 
					{ type: 'folder',
					id: '22222',
					sequence_id: '1',
					etag: '1',
					name: 'Marketing Active Work' },
				item_status: 'active' } ],
			limit: 200,
			offset: 0 }
		*/
	});
// Search for all Powerpoint presentations with the TopSecret metadata applied
client.search.query(
	'',
	{
		file_extensions: 'ppt,pptx',
		mdfilters: [
			{
				templateKey: 'TopSecret',
				scope: 'enterprise',
				filters: {}
			}
		]
	})
	.then(results => {
		// ...
	});