How to get data from API in realtime?

4 Comments

  • Joey

    Hi Adnan-

    If I am reading this correctly, you are making a GET to retrieve all tickets with a certain tag, then a PUT to remove that tag. After the PUT, another GET is still returning the tickets, correct? Are you making a bulk update? This is necessary for remove_tags to function.

    0
  • Thomas Verschoren
    Community Moderator

    Hey,

     

    Your GET method is I think scoped to the search end-point right?

    api/v2/search.json?

    As noted in the API documentation:

    Note: It can take up to a few minutes for new tickets, users, and other resources to be indexed for search. If new resources don't appear in your search results, wait a few minutes and try again.

    What might work faster is using the return of the PUT action as input for your GET result. If you so a /api/v2/tickets/6442.json call directly to the ticket, you get the updated result for that ticket.

    0
  • Adnan

    Hi Joseph,

    Yes I use bulk updates as mentioned in the article

    Update Many Tickets

    PUT /api/v2/tickets/update_many.json

    PUT /api/v2/tickets/update_many.json?ids={ids}

    Accepts an array of up to 100 ticket objects, or a comma-separated list of up to 100 ticket ids.

    my PUT method will remove the tag and add comments to the tickets, I set my code to run every 5 minutes but the issue came up as the next GET method is still returning the tickets then the comments are keep inserted into the tickets.

    I ended up setting my code to run in 1 hour interval but if there is another workaround for this case would be amazing.

    0
  • Joey

    Hi Adnan-

    If it is working at a one hour interval, I might suggest trying to increment down to determine what the best interval is; 5 minutes may be too little, and one hour may be more than necessary.

    0

Please sign in to leave a comment.

Powered by Zendesk