Json form parameters and Invoke-RestMethod

Welcome Forums General PowerShell Q&A Json form parameters and Invoke-RestMethod

Viewing 2 reply threads
  • Author
    Posts
    • #260553
      Participant
      Topics: 52
      Replies: 209
      Points: 871
      Helping Hand
      Rank: Major Contributor

      I’m trying to construct a command for creating a user using our websites api. But I’m struggling to understand how to do it….

      Below I’ve copied the help page for the api I’m using, see  # CreateUser below, and here’s the command I’ve tried, see # Command, this fails. I’ve think that I should also be adding UserMinimalUpdateDTO to the $uri and not as $body. But I’m a bit lost here…..can anyone point me in the right direction ?

       

      I get this error;

       

      CreateUser

       

      <caption>The following routes are available for this service:</caption>

      All Verbs /networks/{networkId}/clients/{clientId}/users

       

      <caption>CreateUser Parameters:</caption>

      NAME PARAMETER DATA TYPE REQUIRED DESCRIPTION
      NetworkId path string No
      ClientId path string No
      UserId query string No
      EmployeeUserId query string No
      UserMinimalUpdateDTO query UserMinimalUpdateDTO No

       

      <caption>UserMinimalUpdateDTO Parameters:</caption>

      NAME PARAMETER DATA TYPE REQUIRED DESCRIPTION
      UserId form string No User Id
      Name form string No Name
      SSN form string No Social Security Number
      Birthdate form DateTime No Date of Birth
      EmailAddress form string No Email Address
      RoleName form string No Blah Role Name
      SpecialistCode form string No Operator Id
      IsInternal form string No This flag is set if the user account is internal to Here

       

       

       

    • #260598
      Participant
      Topics: 1
      Replies: 85
      Points: 387
      Helping Hand
      Rank: Contributor

      I don’t see where you have authenticated. Normally, there’s some kind of token exchange before you can make a change.

    • #260607
      Participant
      Topics: 52
      Replies: 209
      Points: 871
      Helping Hand
      Rank: Major Contributor

      It’s not an authentication issue, there are multiple other posts I do on same site with no problem.

      Its something in the way I’m forming the command but I’m a bit lost and can’t find any articles or posts online about this Query parameter and Form.

      • This reply was modified 3 weeks, 3 days ago by Iain.
Viewing 2 reply threads
  • You must be logged in to reply to this topic.