Create Document in ECM through API

Thanks for the clarification

By the way, not sure if I’m the only one trying this but I’m trying to create documents directly from an external application. I do the following calls:

  1. /AstriaV2/Forms.svc/restssl/CreateDocument
  2. /AstriaV2/Document.svc/restssl/Get
  3. /AstriaV2/Document.svc/restssl/Update

The 1st one creates the document and I see it in the website
The 2nd one is simply for me to get the document before any update
The 3rd one is to update one of my custom fields. It works and it triggers my workflow but once that API call is finished, my document completely disappear from ECM. I see it in my database and nothing seems wrong with the values in there but I can’t find it anymore in the search. The only way for me to view it is to have the document opened and then refresh the page to see that it,s there. But it’s not appearing anywhere

If somebody find a solution to that, hit me up. Would love to find a fix

@Mark_Wonsil @klincecum They haven’t given me perms yet, do one of you want to split this last post off this ‘solved’ thread into it’s own?

Pick me what to split. On my phone lol.

Just that last question where he’s looking for help on a “new” subject.

1 Like

I finally managed to get it working ! Instead of calling the /Update endpoint, I’m calling the /AstriaV2/Document.svc/restssl/UpdateManySlimEx

I found while looking at the network tab in developer console that ECM is calling the UpdateManySlim endpoint when clicking on the ‘Save Button’. That endpoint is not working for some reasons via API but if you use the UpdateManySlimEx, and send an array changes, it works. Here is an example of my JSON:

DocumentId, VersionId, ModifiedTicks can all be get using the /Get endpoint. Same thing for the ‘CustomFieldValues’, simply take the response from the /Get and modify the values as you wish

{
  "DocumentSlimUpdates": [{
    "DocumentId": "1b947682-78bd-ef11-9e1b-005056ad4c6e",
    "VersionId": "1c947682-78bd-ef11-9e1b-005056ad4c6e",
    "ModifiedTicks": "638701316640995593",
    "ElementData": [],
    "CustomFieldValues": [
            {
                        "BigDecimalValue": null,
                        "BoolValue": null,
                        "CustomFieldFormat": null,
                        "CustomFieldGroupId": null,
                        "CustomFieldGroupName": null,
                        "CustomFieldGroupOrder": null,
                        "CustomFieldGroupTemplateId": null,
                        "CustomFieldMetaId": "c48dbd0b-b2d4-ee11-9e0b-005056ad4c6e",
                        "CustomFieldName": "Form_Quotation_ID",
                        "DateTimeValue": null,
                        "DateValue": null,
                        "DecimalValue": null,
                        "DisplayValue": "BONJOUR",
                        "DocumentVersionId": "1c947682-78bd-ef11-9e1b-005056ad4c6e",
                        "FormSetId": null,
                        "Id": "21947682-78bd-ef11-9e1b-005056ad4c6e",
                        "IntValue": null,
                        "JSValue": "BONJOUR",
                        "ListName": null,
                        "LongValue": null,
                        "PackageId": null,
                        "ParentId": null,
                        "SetId": null,
                        "StringValue": "BONJOUR",
                        "TypeCode": 18
                    }    
        ]
  }]
}
2 Likes

Can I just ask what License do you need for this to work?

Not sure but I would guess this one?

1 Like