What can we help you with?

e.g. Gantt chart, Creating tasks, Sharing folders


convert the interface numeric wrikeID to the API wrike ID

1 comment

  • Spot On! ๐Ÿ‘ Innovative Approach ๐Ÿ’ก Stellar Advice ๐Ÿ’ช
    Jan Dijk

    (Edited )

    i found the solution with the permalink field.

    snippit to resolve the task id by the old permalink id in powershell

    $v2wrikeid = xxxxxxx
    $wriketaskData = Invoke-RestMethod -uri https://www.wrike.com/api/v4/tasks?permalink=https://www.wrike.com/open.htm?id=$v2wrikeid -Headers @{'Authorization' = ' bearer '+$accessToken} -Method get
    echo $wrikeID


    here i share some quick and dirty code to add an time entry to a task for a whole year every workday in powershell


    #create wrike time entries for every workday for a whole year
    # uncomment the $output line to actually do it, first test the print out

    $accessToken = "yourv4token"
    # the permalinkid
    $v2wrikeid = XXXXXX

    $wriketaskData = Invoke-RestMethod -uri https://www.wrike.com/api/v4/tasks?permalink=https://www.wrike.com/open.htm?id=$v2wrikeid -Headers @{'Authorization' = ' bearer '+$accessToken} -Method get

    #Print week

    $we = [System.DayOfWeek]::Saturday, [System.DayOfWeek]::Sunday

    $date = Get-Date -Year $beginyear -Month $beginmonth -Day 1

    for ($i=$beginmonth; $i -le 12; $i++)

    $date = Get-Date -Year $beginyear -Month $i -Day 1

    $lastDay = [DateTime]::DaysInMonth($date.Year, $date.Month)
    $firstDate = [DateTime]::new($date.Year, $date.Month, 1)
    $lastDate = [DateTime]::new($date.Year, $date.Month, $lastDay)

    $workdays = 0

    while ($now -le $lastDate){

    $now = $now.AddDays(1)

    if ($now.DayOfWeek -notin $we ) {

    $payload = 'hours=0.5&trackedDate=' + ($now).Tostring("yyyy-MM-dd") + '&comment=' + ($now).Tostring("yyyy-MM-dd") + ': time entry subject |'
    #uncomment to actually output, test it manually first before you loop.
    ##$output = Invoke-RestMethod -uri https://www.wrike.com/api/v4/tasks/$wrikeID/timelogs -Headers @{'Authorization' = ' bearer '+$accessToken} -Method Post -body $payload
    Remove-Variable payload




    Is this helpful? 1
    Comment actions Permalink

Please sign in to leave a comment.

Folllowing List for Post: convert the interface numeric wrikeID to the API wrike ID
[this list is visible for admins and agents only]


Welcome ๐Ÿ––

Hi there! ๐Ÿ™‚ Want to become a black belt Wrike Ninja? Here's how to earn a Wrike badge

Welcome ๐Ÿ–– Have you checked out this week's Release Notes yet?

Hey! ๐Ÿ‘‹ Curious about something? Visit How To to search and ask the Community for answers.

Welcome! ๐Ÿ‘‹ Figured out a good tip or trick? Share it in Best Practices.

Want to connect your existing software to Wrike? Learn and ask how in the API section.