Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Post Single object and get array object #123

Open
devzonetrack opened this issue Sep 13, 2018 · 2 comments
Open

Post Single object and get array object #123

devzonetrack opened this issue Sep 13, 2018 · 2 comments

Comments

@devzonetrack
Copy link

Howto post single object as parameter and get array object as result?

@fernand-o
Copy link
Contributor

fernand-o commented Sep 13, 2018

something like this should work:

type
  TUser = class
    name: string;
    username: string;
  end;
  TUsers = TArray<TUser>;

  TParams = class
    kind: string;
  end;
var
  Params: TParams;
  Users: TUsers;
begin
  Params := TParams.Create;
  Params.kind := 'admin';

  Users := Client.Resource('https://jsonplaceholder.typicode.com/users').Get<TUsers>;
  // or 
  Users := Client.Resource('https://jsonplaceholder.typicode.com/users').Post<TUsers>(Params);
end;

@devzonetrack
Copy link
Author

Helo fernand-o
Thank very much this working fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants