The following documentation is followed:
https://docs.superoffice.com/en/api/netserver/web-services/howto/document/rest-generate-document.html?tabs=generate-document-rest
The first step, creating the document data set via the API, is successfully completed. However, when generating the content - both via a document template and when uploading the content directly - the following error message always appears:
„Cannot create directory \\**\con\2025.1 because a file already exists with that name.“
This error message also occurs if a new, non-existent file name is specified when the document data record is created.
If a document is created directly in SuperOffice and the content is then overwritten/updated via the API, this works without any problems - in this case a new, unique file name is automatically generated.
The document is available in SuperOffice as a template and contains contact and company variables that should also be filled in via the API
Does anyone have more detailed information or suggestions for solutions?
All Replies (10)
Hi Ralf,
I am unable to reproduce your error.
Using the REST API, I can create a document based on a template and a stream without issue.
// Get a document entity
GET https://{{env}}.superoffice.com/{{tenant}}/api/v1/Document/default
Authorization: Bearer {{token}}
Accept: application/json
Then persist the document entity:
POST https://{{env}}.superoffice.com/{{tenant}}/api/v1/Document
Authorization: Bearer {{token}}
Content-Type: application/json
{
"DocumentId": 0,
"UpdatedBy": null,
"CreatedBy": null,
"Attention": "",
"Header": "My document header test",
"Name": "MyDocumentTest.docx",
"OurRef": "",
"YourRef": "",
"CreatedDate": "0001-01-01T00:00:00Z",
"UpdatedDate": "0001-01-01T00:00:00Z",
"Description": "",
"DocumentTemplate": { DocumentTemplateId: 2 },
"Person": { PersonId: 8 },
"Associate": null,
"Contact": { ContactId: 5 },
"Project": null,
"Date": "0001-01-01T00:00:00Z",
"ExternalRef": "",
"Completed": "NotStarted",
"ActiveLinks": 0,
"Type": "Document",
"Links": [],
"LockSemantics": "None",
"Sale": null,
"SuggestedDocumentId": 0,
"Snum": 0,
"UserDefinedFields": {
"SuperOffice:3": "False",
"SuperOffice:3:DisplayText": "[SR_NO]",
"SuperOffice:4": ""
},
"ExtraFields": {},
"CustomFields": {
"SuperOffice:3": "[I:0]",
"SuperOffice:3:org": "[I:0]",
"SuperOffice:3:DisplayText": "[SR_NO]",
"SuperOffice:4": "",
"SuperOffice:4:org": ""
},
"PublishEventDate": "0001-01-01T00:00:00Z",
"PublishTo": "9999-12-31T23:59:59Z",
"PublishFrom": "0001-01-01T00:00:00Z",
"IsPublished": false,
"VisibleFor": [
{
"VisibleId": 0,
"Visibility": "All",
"DisplayValue": "[SR_VFC_ALL]",
"TableRight": null,
"FieldProperties": {}
}
]
}
Then generate the physical document based on the template:
// Assuming returned document ID from above was 166
// Create the physical document from template
POST https://{{env}}.superoffice.com/{{tenant}}/api/v1/Document/166/Content
Authorization: Bearer {{token}}
Accept: application/json
Otherwise, get a document stream, set the hearders based on what you are sending...see the DOCS
PUT https://{{env}}.superoffice.com/{{tenant}}/api/v1/Document/166/Content
Authorization: Bearer {{token}}
Content-Type: application/octet-stream
Accept: application/json
"VEVTVCBET0NVTUVOVA==",
So, please provide instructions how to reproduce your error. Use whatever language or code you are using in development.
Are you using an Online or OnSite environment?
In case of OnSite, This bug might be related: https://community.superoffice.com/en/product-releases/bugs-wishes/product-issue/?bid=71284&azure=1:
Hi Ralf! Thanks for the reproducable code snippet. We are sorry for the inconvenience, and have flagged this bug and it is slated to be fixed/released in the next onsite release.
Best regards.
Hello Tony
good news, we wait for v10.5.4 for onsite in April.
May I ask you to have a quick look on the following request
We embedded a webinar registration on our website with REST API link to SuperOffice. We face a final problem not knowing how the execute the double-opt in.
( a ) Is it possible to trigger a form submit with via REST API to initiate the normal double opt-in which we would like to use for e-mails which are not yet stored in SuperOffice
For repeat registration we would like to not only add the contacts to the webinar project but also document it in SuperOffice as it is normally done by form submission protocolled as activity.
( b ) can we set form submission entities via REST API or any other idea?
Best regards
Ralf
Hi Ralf,
Unfortunately there is no API to send a form submittion via the API. There was a wish for it, but that was not prioritized and closed.
You can use the PersonAgent.SendConsentConfirmationEmail to method. The person must already exists, and the person must already have the Consent Info already set. If not, you can use the PersonAgent.CreateDefaultConsentPerson API to create one, and then save it using the PersonAgent.SaveConsentPerson API.
Hope this helps!