System Information
- **Strapi Versionv4.10.2:
- **Operating SystemWindows:
- **DatabaseMysql:
- **Node Versionv16.16.0:
-
NPM Version:
-
Yarn Version:
How do I call an endpoint, to add relationships, for example, I sign a document with user 1 and send the document to user 2, but when he signs, I do a PUT, he overwrites my user, I wanted him to add it, and do not subscribe, follow the image, because in the strapi manually it is possible,
notice that I added the user Renan Henrique, and the user Rocha, manually, but doing it through the API, I don’t know how to add more users, without just subscribing, that is, a digital signature platform
Hey,
I suggest you use GET query first to fetch the existing Sign record details where you will also get the existing User ID and then after append it in an array with new User ID and update it.
How would it look like this:
const responseGet = await api.get(rest of the code…
const userName = response.data.data.name;
const response = await api.put(
/contrato-assinados/${contract1}
,
{
data: {
data: new Date().toISOString(),
usuario_ids: [userName + userId],
status: 7,
contrato_ids: id,
hashBlockChain: tx.hash,
hashDocumento: confirmationToken,
},
},
{
headers: {
Authorization: Bearer ${token}
,
},
}
);
?
I’m a junior developer, so they gave me this super responsibility
Thanks Shekhar, funcionou
1 Like