Discussions
Set and remove WO Flags via API
Hi,
I am able to query and return the flags set agaist a WorkOrder using the query API and the WoFlag entity.
I am trying to set a new flag against a WorkOrder, and also remove a Flag - using the base API POST and DELETE methods.
However, I am getting the response that these are not supported by the WoFlag Entity.
See my responses received at the foot of this message.
My questions is, is there a method to set and remove flags from a WorkOrder via API?
Thanks again for your help.
Responses:
{
"ErrorMessage": "Create operation is not supported by WoFlag entity.",
"ErrorCode": "ERROR_CODE_1000",
"TimeStamp": "2024-04-10T13:50:29.5806831Z"
}
{
"ErrorMessage": "Delete operation is not supported by WoFlag entity.",
"ErrorCode": "ERROR_CODE_1000",
"TimeStamp": "2024-04-10T13:42:17.0226544Z"
}
Hi Graham,
Use WoFlagCommand entity:
https://XXXXX/api/v1/cmd/WoFlagCommand
Sample payload:
{
"Command": {
"WorkOrderId": 36,
"ActionReasonId": 0
},
"RequestId": "1234"
}
Hi Sachin,
Thank you - that works great for setting a flag.
Is there a related method to remove a flag from a WO?
Thanks again,
Graham
Hi Sachin,
With regards to my question on how to clear flags, I have found the "WoClearFlagsCommand" entity.
I've used the following sample payload, which has an identical body to the method used to set a flag.
POST https://emea-ent-f2.corrigo.com/api/v1/cmd/WoClearFlagsCommand?= HTTP/1.1
{
"Command": {
"WorkOrderId": 68064,
"ActionReasonId": 3375
},
"RequestId": "1234"
}
And the response I am getting is:
{
"ErrorMessage": "Value cannot be null.\r\nParameter name: source",
"ErrorCode": "BUSINESS_LOGIC_ERROR",
"TimeStamp": "2024-04-16T15:04:09.049491Z"
}
I've not seen anything about a "source" parameter in the documentation.
Can you confirm if this is the correct command to use to clear a flag, and what the missing parameter might be?
Thanks again
Graham
Hi Graham,
You can use below payload with WoFlagCommand entity to clear all flags. Keep "ActionReasonId": 0.
{
"Command": {
"WorkOrderId": 36,
"ActionReasonId": 0
},
"RequestId": "1234"
}
Thanks Sachin,
Thank you for this.
Is there a method to remove a specific flag? I have a use-case for that.
Kind regards,
Graham
You have to pass correct "ActionReasonId": VALUE
Regards,
Sachin
Hi Sachin,
Thanks again.
If I send the correct "ActionReasonId":VALUE, it will ADD a specific flag.
But if I then send that again, it does not REMOVE the specific flag.
eg.
{
"Command": {
"WorkOrderId": 68064,
"ActionReasonId": 3375
},
"RequestId": "1234"
}
Based on the command above that ADDS the flag, how would I then REMOVE the flag with "ActionReasonId":3375 from WO 68064 without removing all flags from the WO.
Apologies if my question wasn't clear, hopefully that is clearer now.
Thank you
Graham
Try with WoClearFlagsCommand.
Regards,
Sachin
Thanks Sachin,
Thanks again,
With regard to using the WoClearFlagsCommand, please see item 4 in this thread, where I tried that but got an error.
Copied here for convenience.
"Hi Sachin,
With regards to my question on how to clear flags, I have found the "WoClearFlagsCommand" entity.
I've used the following sample payload, which has an identical body to the method used to set a flag.
POST https://emea-ent-f2.corrigo.com/api/v1/cmd/WoClearFlagsCommand?= HTTP/1.1
{
"Command": {
"WorkOrderId": 68064,
"ActionReasonId": 3375
},
"RequestId": "1234"
}
And the response I am getting is:
{
"ErrorMessage": "Value cannot be null.\r\nParameter name: source",
"ErrorCode": "BUSINESS_LOGIC_ERROR",
"TimeStamp": "2024-04-16T15:04:09.049491Z"
}
I've not seen anything about a "source" parameter in the documentation.
Can you confirm if this is the correct command to use to clear a flag, and what the missing parameter might be?
Thanks again
Graham"
ο»Ώ