Skip to content

JArray on Post #219

Closed
Closed
@lukasroberts

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?

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