Comments (12)
See if the PATCH /documents/{documentId}
API will solve this for you. It allows you to send an array of tags to a document and add or update all of them. Here's the documentation for it: Update Document API reference
from formkiq-core.
@Stason1o We will add this to our roadmap.
from formkiq-core.
@RyanBuhrWA , didn't see that functionality, was looking specifically on DocumentTags endpoints. I will try your suggestion today to see if it works fine for me and will come back with details later. Thanks!
from formkiq-core.
So, follow up to workaround @RyanBuhrWA mentioned with patch endpoint. I tried to send a payload, having only list of tags supplied, without content, and then, all getDocumentContent requests are failing with 500, but I couldn't find logs for the root cause of this( limited access to company CloudWatch) so, I guess this does not fit my case(unless I get access to CW and investigate logs).
Supplying everytime content could be resource heavy, having in mind that documents could be huge size, and rewriting same content everytime tags are updated is also not a good solution..
But anyway, thanks for helping!
Will stick to current implementation - looping through tags and calling PUT document tag one by one, until new endpoint is released
from formkiq-core.
@Stason1o Can you provide the request you sent using PATCH /documents/{documentId} and we can look into the 500 error you are seeing.
from formkiq-core.
@mfriesen Hi,
So basically the steps I am performing with document:
- Create document: POST: /documents with valid body - 200 Response
- Update Document, 2 steps:
Adding New tags( if they don't exist on document yet) using POST: /documents/{documentId}/tags
Updating Existing ones, using PATCH: /documents/{documentId}, with payload and getting 200 Response:
{
"tags": [
{
"key": "string",
"value":"string",
},
{
"key2": "string",
"value2":"string",
}
]
I am not supplying content for this request, because I don't have it fetched at that moment from Formkiq. Sending content as a part of this request will require addiitional GetDocumentContent, which is "redundand" for me, because I am working with tags only at that moment.
- Trying to get documentContent and this fails with 500 Response, indicating url, I was calling (could be our custom error response)
If I call GetDocumentContent before calling Patch Document, I receive 200 Response and document content. After calling Patch Document, and then GetDocumentContent - I get 500 response.
I suppose, that after calling Patch Document without supplying content in request body, FormKiq will set is as null? and this is causing issues on GetDocumentContent?
from formkiq-core.
Recently changes where introduced for POST /documents/{documentId}/tags, to support adding List of tags. I would like to suggest adding same support for updating multiple document tags in one request for PUT /documents/{documentId}/tags/{tagKey}
@Stason1o I assume you mean to add a PUT /documents/{documentId}/tags instead of /documents/{documentId}/tags/{tagKey}
with a body of
{
"tags": [ ... ]
}
which would replace all the tags in a document?
from formkiq-core.
@mfriesen, so basically I need an endpoint, which will accept body
{
"tags": []
}
and for each tag from request body, if this tag exists on document, its value will be updated to the value from request body.
Scenario:
- I have created a document with tags:[ id, type(img), subtype(nature)]
- I want to add additional tags to it. I use endpoint POST /documents/{documentId}/tags with body,
containig new tags:
{
"tags": [case, comment, description, status(in_validation)]
}. In result now document has list of tags:[id, type(img), subtype(nature), case, comment, description, status] - Now I want to update some of the tags - type(png), subtype(city).
With current version, I need to use PUT/documents/{documentId}/tags/{tagKey} and make a call for each tag I want to update and supply new value/values
Feature request - have an endpoint which accepts tags:[] and updates exising tags with supplied value/values
like PUT/PATCH /documents/{documentId}/tags
{
tags:[type(png), subtype(city)]
}
so I will make one request for updating multiple tag values at once, instead of calling formkiq service 20-30 times, depending on how many tags I need to update
Result - document tags are updated and document has tags:[id, type(png), subtype(city), case, comment, description, status]
from formkiq-core.
GetDocumentContent - I get 500 response. I suppose, that after calling Patch Document without supplying content in request body, FormKiq will set is as null? and this is causing issues on GetDocumentContent?
@Stason1o
Unfortunately I have been unable to duplicate the 500 issue you are experiencing. Would it be possible for you to look at the CloudWatch logs for the "DocumentsApi" lambda for a stack trace of the error you can send to me?
from formkiq-core.
@mfriesen So, I tried this morning and got same results.
Steps I performed:
- Create a document with child document POST: /documents
addDocumentPayload.txt
Note: At this point GET /documents/{documentId} and GET /documents/{documentId}/content are working as expected.
- Update document tags(metadata), by calling update document endpoint PATCH /documents/{documentId}, by adding 4 new tags and 1 existing tag with body: { tags: [] }
Response is 200.
- Perform call to GET /documents/{documentId}/content
expected: 200 and content
actual - 500 error:
from formkiq-core.
@Stason1o Thank you so much for the details. I'm still not able to replicate the issue.
Which version of FormKiQ are you using? From the logs, it looks like you are on v1.8.9?
from formkiq-core.
@mfriesen Yeah, it's 1.8.X (not sure about minor version), we will be migrating to newer version as soon as v1.12 will be out =)
Anyway, thanks for help.
from formkiq-core.
Related Issues (20)
- Search for Document Attributes eqOr returns all records
- Creating a DeepLink Document returns an uploadUrl
- Multiple file uploads can trigger 503s on API Gateway when submitting document actions
- POST /documents & Patch /documents/{documentId} doesn't post actions when using deeplink actions
- Add AppEnvironment to GET /version
- POST /documents returns presigned urls when sending deeplinkpath
- Deep link for OneDrive not passing URL validation
- Add related documents functionality attribute
- Locale Support
- User Administration: Add 400 response on invalid characters in group names
- Add official deployment template and support for three new AWS regions (Ireland, Paris, and Singapore)
- PATCH /documents with required siteschema attribute
- Add Checksum SHA-1, SHA-256 options HOT 1
- Search by documentIDs (currently only a filter)
- Mark GET /documents/upload and GET /documents/{id}/upload as deprecated, and add POST /documents/{id}/versions/upload
- Document Path starting with "." creates folder with "." name
- Add an endpoint to retrieve a folder index key based on the path
- Add Admin API Key
- POST /documents: range keys has exceeded the size limit of 1024 bytes
- Prevent double slashes in path for documents
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from formkiq-core.