Admin API and PUT Method - 404?

Discussion in 'LiquidFiles General' started by Russell Meyer, Aug 15, 2019 at 4:55 AM.

  1. Russell Meyer

    Russell Meyer New Member

    Joined:
    Thursday
    Messages:
    1
    Likes Received:
    0
    Working on the API and I am able to get data, delete users, but when I attempt to update data via the PUT method it comes back with a 404 error...the json body looks good

    {
    "user": {
    "group": "dummygroup"
    }
    }

    but I am doing this with invoke-webrequest with powershell (which I am able to do with other JSON sites and also snag data above)

    $pair = "$($apikey):$($pass)"
    $bytes = [System.Text.Encoding]::ASCII.GetBytes($pair)
    $base64 = [System.Convert]::ToBase64String($bytes)
    $basicAuthValue = "Basic $base64"
    $headers = @{'Authorization'=$basicAuthValue}

    $Website = "https://serverFQDN/admin/users/$userID" (which is legit info from the array, works for grabbing data)
    $UpdateGroup = [ordered]@{
    "user"=[ordered]@{
    "group"="dummygroup";
    }
    }
    $UpdateGroup = $UpdateGroup | ConvertTo-Json
    Invoke-WebRequest -Uri $TempWebsite -Headers $headers -Body $UpdateGroup -ContentType 'application/json' -Method put

    thoughts????
     
  2. David

    David Administrator
    Staff Member

    Joined:
    Dec 1, 2015
    Messages:
    670
    Likes Received:
    14
    Interesting, expect the group which should be updated, can you please try to add there some another attribute like the email address in to the request together with the group. The email just place there don't have to be changed.

    {"user":
    {
    "email": "user@domain.com",
    "group": "external-users"
    }

    }
     

Share This Page