Jump to content

SumitSaini

Level 1
  • Posts

    3
  • Joined

  • Last visited

About SumitSaini

SumitSaini's Achievements

0

Reputation

  1. Hello Evernote Community, I'm currently working on a project where I need to search for notes in Evernote using specific keywords. However, when I use the search API with the keyword, I'm consistently getting an empty array as the result, even though I know there are notes containing the specified keyword. Code Example: // Sample code for searching notes by keyword // ... (code for authenticating and setting up the client) const keyword = 'exampleKeyword'; const filter = new Evernote.NoteStore.NoteFilter({ words: keyword, }); const resultSpec = new Evernote.NoteStore.NotesMetadataResultSpec({ includeTitle: true, includeCreated: true, }); const searchResults = await noteStore.findNotesMetadata(authToken, filter, 0, 10, resultSpec); console.log('Search results:', searchResults); Thank you in advance for your assistance
  2. Hello Evernote Community, I hope this message finds you well. I'm currently facing an issue with uploading images to the Evernote Sandbox API and could use your expertise to help troubleshoot and resolve it. I've been following the Evernote API documentation to upload images to notes using the media tag and resource object. However, despite my best efforts, the images aren't showing up in the notes as expected. I've thoroughly reviewed my code and ensured that I'm following the correct steps, but I must be missing something. Here's a simplified version of the code I'm using for the image upload: // Code snippet for uploading images to Evernote Sandbox API const fs = require('fs'); const axios = require('axios'); const authToken = 'my-auth-token'; const imageUrl = 'https://example.com/image.jpg'; // Hosted image URL async function uploadImageToNote() { try { const imageBuffer = await axios.get(imageUrl, { responseType: 'arraybuffer' }); const imageData = imageBuffer.data; const hash = require('crypto').createHash('md5').update(imageData).digest('hex'); // Construct the resource object const resource = new Evernote.Types.Resource(); resource.mime = 'image/jpeg'; resource.data.body = imageData; resource.data.size = imageData.length; resource.data.hash = hash; resource.attributes: { fileName: "dog.jpg", // Change the filename if needed hash: hash, }, // Create the note const note = new Evernote.Types.Note(); note.title = 'My Note Title'; note.content = ` <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE en-note SYSTEM "http://xml.evernote.com/pub/enml2.dtd"> <en-note> <p>This is a note with an attachment:</p> <en-media type="image/jpeg" hash="${hash}" width="160" height="160"/> </en-note> `; // Upload the note to Evernote const createdNote = await noteStore.createNote(note); console.log('Note created:', createdNote); } catch (error) { console.error('Error uploading image:', error); } } uploadImageToNote(); I've ensured that the image data is properly converted to base64 and included in the resource object. However, when I check the notes, the images aren't displaying. If anyone has experience with the Evernote Sandbox API and image uploads, I'd greatly appreciate your help in troubleshooting this issue. I'm attaching a screenshot of the note created using the above code. Have you encountered a similar problem before? Is there anything specific I might be overlooking? Your insights and suggestions would be incredibly valuable in helping me resolve this issue and make progress with my project. Thank you in advance for your assistance
×
×
  • Create New...