Skip to content

JArray on Post #219

Description

@lukasroberts

When trying to POST data to some custom endpoints such as the contact API that is not yet implemented with the existing client, i would like to post this kind of JSON

[ { "email": "jones@example.com", "last_name": "Jones", "pet": "Indiana", "age": 25 }, { "email": "miller@example.com", "last_name": "Miller", "pet": "FrouFrou", "age": 32 }, { "email": "invalid_email", "last_name": "Smith", "pet": "Spot", "age": 17 } ]

Given the POST method on the Client currently takes a JObject, this is not possible. I would like to submit a pull request with the change of refactoring the RequestAsync method on the client to look like this:

private async Task<HttpResponseMessage> RequestAsync(Methods method, string endpoint, object data)

And add another method for POST that takes a JArray as a parameter, like this:

public async Task<HttpResponseMessage> Post(string endpoint, JArray data) { return await RequestAsync(Methods.POST, endpoint, data); }

What is everyones thoughts on this? Would this be something you would consider?

Activity

  1. Jericho commented on May 4, 2016

    @Jericho

    I already implemented this functionality in my fork and submitted a PR

  2. lukasroberts commented on May 4, 2016

    @lukasroberts
    Author

    Fair enough, hopefully it gets merged in soon then!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions