GQL queries with attributes
We have a need to automate lots of BSM service creations and I am struggling with GQL now.
We have created attribute to be used for har
query {customAttributes
(first: 7, search: {name: {eq: "BSM_Region"}})
{
edges {
node {id label type entity alignmentType
}
}
}
}
and that gives us:
{
"data": {
"customAttributes": {
"edges": [
{
"node": {
"id": "57",
"label": "BSM_Region",
"type": "string",
"entity": "harProvider",
"alignmentType": "extended"
}
}
]
}
}
}
If I then try to align that attribute to spesific service like this:
mutation {alignCustomAttribute(
attribute:57,
entity: "cm03r2q3a807hs5mn8m4a1dga",
value:"Koillismaan kauppa",
type: harProvider
)
{__typename}
}
It gives an error:
{
"errors": [
{
"path": [
"alignCustomAttribute"
],
"message": "The following id/ids: 57 could not be found. Failed to align custom attributes.",
"extensions": {
"code": "ID_NOT_FOUND"
}
}
],
"data": {
"alignCustomAttribute": null
}
}
Some help needed here.
OK, solution found.
Against documentation in /gql, when you utilize SL1 attribute information the "id" is not the ID that is mentioned in docs, and everywhere else it is the DID,GUID etc, but in this context it points to name,
So actually here we needed to use it this way:
type:harProvider
attributes: {
id:"BSM_Region"
value:"Koillismaan kauppa"
},Thanks jchivers for info!