
Hello. We are trying out Appwrite. We've gone through the getting started and setup guide and are attempting to create a document, copy/paste from the Getting started website here https://appwrite.io/docs/products/databases/quick-start except we've moved the createDocument to it's own function
func createDocument() async throws { do { let document = try await databases.createDocument( databaseId: databaseId, collectionId: collectionId, documentId: ID.unique(), data: ["title", "hamlet"] ) print(document) } catch { print(error) } }
the My Books collection has an empty database with a single attribute "title" as String. When calling the function the return value is vague:
Invalid document structure: Unknown attribute: "0"
and the data is not written. Not sure where the "0" is generated from.
We think the api endpoint is correct "https://fra.cloud.appwrite.io/v1" however, the documentation does not match the website so we cannot verify.
One other note is that in the Quick Start guide, it says "You can skip optional steps." but it doesn't indicate which are optional, all of the steps following that statement? Perhaps some are required?

I can ans about the endpoint The new endpoint added few weeks ago the fra indicating the server location Although using the old one (the one in the documentation) will also work

Also
Your code has a mistake
data: ["title" : "hamlet"]
You have written , instead of :

awesome. I think the , was the issue! OE on that one. Thank you for catching my typo

I couldnt determine which optional steps you were talking about. Could you tell me about this step/s mentioned?

So its working now?

"Optionally, add a custom database ID" If you were talking about these part then this indicates either you can use ID.unique or just give a unique id according to your wish. So, lets say you have a collection and kind of want to have same id as the collection name You could do that.

Thanks for the followup. The guide here https://appwrite.io/docs/quick-starts/apple about 1/2 way down says "You can skip optional steps". We assume everything below that statement are "option steps" but were not sure.

Maybe they ment the account creation stuff I dont know about swift Maybe the data related to using Oauth by Apple is optional 🤷♂️ Like you could go without sign in if your app doesnt need it 🤷♂️

Got it. Thanks. It's 'working' but we are still trying to figure out what is returned from the queries. e.g. in Swift let documents = try await databases.listDocuments
and we are not sure the format of the returned data. Will keep digging in trying to find out.
Recommended threads
- Apple OAuth in SwiftUI
Any ideas why this error might be showing up when trying it sign in via apple in SwifUI? _Concurrency/CheckedContinuation.swift:196: Fatal error: SWIFT TASK CO...
- Upload file
i got this error when try upload file (.Net). I use this line to check my buucket and its all right var buckets = await appWriterInit.Storage.List...
- Need help on Flutter OAuth2
Am trying to use Appwrite OAuth (google, apple and facebook), am been on it for sometimes now which have tried many things but still not able to make it work: ...
