Trouble with Web Service Parameter from Workflow

Greetings,

I'm having trouble invoking a web method using a parameter from a previous web method. 

  1. The first web method gets the asset from a ticket
    1. https://skagit.teamdynamix.com/TDWebApi/api/1271/tickets/{{id}}/assets
    2. Parameter: 
      1. Name: id
      2. Data type: String
      3. Source: From Ticket
      4. Source Property: ID
    3. Response: 200 - Works in testing and in the workflow. 
    4. Workflow body result stored in: AssetFromTicketBody 
  2. The second web method gets the asset's full attributes from the asset's ID.
    1. https://skagit.teamdynamix.com/TDWebApi/api/1272/assets/{{id}}
    2. Parameter:
      1. Name: id
      2. Data type: String
      3. Source: From Workflow
      4. Source Property: AssetFromTicketBody.BackingItemID
    3. Testing: Works fine, as the test asks for the asset ID. 200
    4. Workflow Log Response: 405 Method Not Allowed. Message: The requested resource does not support http method GET.
    5. Workflow Log Request Endpoint shows as GET https://skagit.teamdynamix.com/TDWebApi/api/1272/assets/ as if it is not receiving the asset ID from the previous method step.

What am I doing wrong?

 

Thanks!

 

Tags workflow web-method From-Workflow
Asked by Torstein Early on Mon 5/23/22 12:01 PM
Sign In to leave feedback or contribute an answer

Answer (1)

This answer has been marked as the accepted answer
Mark Sayers Mon 5/23/22 12:11 PM

Hello Torstein,

This is likely being caused because the result from web service 1 should be an array of assets (because you can have more than 1 asset associated with the ticket), so in step 2, you'd have to reference the response body and also the index position of the array where you expect this asset in question to be. If it'll always be the first asset, or the only asset, associated with these tickets, you would reference that as index position 0.

So you'd reference the parameter from workflow, and give it a value of: responsebodyname.[0].BackingItemID

2 of 2 users found this helpful.
That worked. Thanks.

Interesting. So, since the index is hardcoded into the web method, there is no easy way to iterate over the array from within the workflow? Or is there some way to iterate through an array from within a workflow that I'm unaware of?

Is there some other way to iterate through the array? Maybe via some other web method?

What I would like to accomplish is to attach multiple assets to a ticket, and have the workflow update a date field on the assets.

Thanks.
- Torstein Early Mon 5/23/22 12:37 PM
Correct, there is no easy way to iterate over the array within the workflow.

To my knowledge, only iPaaS is able to truly iterate through an array for you (but that is a separately paid product add-on).
- Mark Sayers Mon 5/23/22 1:04 PM
Short of iPaaS, maybe you could use webhooks connected to some system on your end that is able to parse the resulting ticket object, look through the assets array, and make calls to each item in the array to update them with the desired date value. But that would be a lot of work and it would be entirely custom work you'd need to perform. - Mark Sayers Mon 5/23/22 1:06 PM
Interesting about iPaaS. In the meantime I think I can accomplish what I want to do with a simple PowerShell script, that will be a simpler solution.

Thanks!
- Torstein Early Mon 5/23/22 1:07 PM