Back

[SOLVED] Unable to fetch/create Documents

  • 1
  • Android
snapcase
23 Jul, 2023, 09:56

I'm trying to figure out how to create a new document by fetching data from 3 text fields, I get this error: io.appwrite.exceptions.AppwriteException: Param "documentId" is not optional. when I try to fetch the existing data from the document, I get this: io.appwrite.exceptions.AppwriteException: Not Found Please let me know if I'm unclear with my question.

TL;DR
User encountered the error "The current user is not authorized to perform the requested action" and was able to resolve it by adding access to anyone in the database settings. User had another issue with the documentId parameter and was able to fix it by adding "unique()" to documentId and removing null. User was also passing the wrong parameters and was advised to check the createDocument() function or refer to the documentation. It was also suggested to not call toString() on the data. User provided their code and mentioned an error they encountered when trying to fetch existing data or create a new document. They requested clarification if their question was unclear.
snapcase
23 Jul, 2023, 09:57

Here's my code:

Drake
23 Jul, 2023, 16:30

You're not passing the right parameters. Mouse over createDocument() to see what the parameters are. Or you can look at the docs.

Also, I don't think you need to call toString() on the data.

snapcase
24 Jul, 2023, 08:53

But it requires String for all the databaseId, collectionId, and documentId. I replace data.toString() with random value assuming that it's the documentId for the new entry

snapcase
24 Jul, 2023, 08:53
snapcase
24 Jul, 2023, 08:53
snapcase
24 Jul, 2023, 09:28

Oh I got it now, adding "unique()" as documentId and removing null fixed my issue

snapcase
24 Jul, 2023, 09:28

How do I resolve this!? io.appwrite.exceptions.AppwriteException: The current user is not authorized to perform the requested action.

snapcase
24 Jul, 2023, 09:32

Got it!! add access to anyone in the database settings it'll work.

snapcase
24 Jul, 2023, 09:33

[SOLVED] Unable to fetch/create Documents

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more