Hi all, I am not sure if this is the correct category to post my issue.
I am really struggling since yesterday to add contacts into my nextcloud server via n8n / API / http request
I would really appreciate if you guys can guide me on how to setup that.
Something like this:
make a post request to your nextcloud URL
include in the header ( username and password )
include in the body json field with the contact information.
I don’t see any contacts related methods right away… but maybe you are lucky.
additionally I’m under impression contacts are exposed through WebDAV - maybe you can access them this way…
As filename use the same UID as in the vcf and make sure to create different UIDs for different contacts.
Add more values to your liking according to RFC 6350
Configure HTTP Request Node in n8n:
Drag an “HTTP Request” node onto your workflow.
Double-click on the node to configure it.
Set HTTP Request Method and URL
Choose the appropriate HTTP method, likely POST in your case.
Set the URL to your Nextcloud Contacts API endpoint. It might look something like https:// your-nextcloud-instance/remote. php/dav/addressbooks/user/addressbook/.
Configure Headers:
Add headers for authentication. For Nextcloud, you might use Basic Authentication. Add a header with the key Authorization and the value Basic base64(username:password). Replace base64(username:password) with the base64 encoding of your Nextcloud username and password concatenated with a colon (e.g., base64(‘yourUsername:yourPassword’)).
Set Body Content:
In the “Body” section, select JSON/RAW if you are sending JSON data.
Enter the JSON payload with the contact information.
Save and Execute:
Save your workflow and execute it to test the setup.
Here’s a breakdown of the JSON payload:
cards: An array of contact cards. You can have multiple cards if you want to add multiple contacts in one request.
addresses: An array of addresses associated with the contact.
emails: An array of email addresses associated with the contact.
fn: The full name of the contact.
Make sure to adapt the payload based on the specific requirements and structure of the Nextcloud Contacts API.
Please note that using basic authentication in the headers might expose your credentials if not done securely. In a production environment, consider using more secure authentication methods, such as OAuth tokens, if supported by Nextcloud.
Hi,
I tried above curl with postman but it gives me error.
<?xml version="1.0" encoding="utf-8"?>
<d:error xmlns:d=“DAV:” xmlns:s=“sabre/dav”>
<s:exception>Sabre\DAV\Exception\NotFound</s:exception>
<s:message>Addressbook with name ‘newaddressbook’ could not be found</s:message>
</d:error>
I see there is newaddressbook and I copied URL from nextcloud ContactSetting>Addressbook three dots and copy link…
Error and Issue looks different… Tried almost everything…
This is my PHP Request…