Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to update a custom date field with data from external http response

Ergun August 31, 2023

Hi,

I have an automation where a http request is made to external url (populated with card data) and need to use a date field in the returned httpresponse json to update a custom date field.

However for updating a date field I could not find the option to use a variable. 

Does anyone have an idea how to implement this?

Thanks a lot

3 answers

1 vote
Adam Cao
Atlassian Partner
August 31, 2023
So you can use the custom field endpoint:
PUT `cards/${idCard}/customField/${customField.id}/item`
With a JSON body that looks like this:
{
  "value": {
    "date": "2023-08-31T13:01:01.222Z"
  }
}
Ergun August 31, 2023

How can i get the idCard and customField.id?

Ergun August 31, 2023

I am running the url request from a card button. Is there not a way to access it without having to make a request? I mean the cardId is already known as I am calling the action through that card button.

0 votes
Ergun August 31, 2023

I was able to post the response as comment, but what i want to to is update a custom field of data type date with the reponse data.

This i could not do.

Daydreamer Mike
Community Champion
August 31, 2023

Ahhh, yes I did come across this too and had to use the comment as a kind of parser....

A little clunky but it works...

When a comment containing "Lat:{*}" is posted to a card, set custom field "Field" to "{wildcard1}"
0 votes
Daydreamer Mike
Community Champion
August 31, 2023

Hi,

Please take a look at this section of the documentation to see how responses work.

https://support.atlassian.com/trello/docs/issuing-http-requests/#Response 

I have had to play around with this a little bit to get it to work. It doesn't handle complete arrays but you can have array items.  For example, in this one I am gathering data from a location API

 

post comment "Lat:{httpresponse.results[0].geometry.location.lat}\nLong:{httpresponse.results[0].geometry.location.lng}"

I tend to get the response structure by using this tool to help guide me:

https://reqbin.com/post-online 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events