Skip to content

Sending and using variables in an easy api call #42

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

Open
Reddevildragg opened this issue Feb 8, 2018 · 2 comments
Open

Sending and using variables in an easy api call #42

Reddevildragg opened this issue Feb 8, 2018 · 2 comments

Comments

@Reddevildragg
Copy link

Hi
Im just working with the azure code here, and wondering if there is an example anywhere of sending custom data to the easy api system and then being able to access that on the server. So far i have been trying to use
/// <summary> /// Invokes custom API with body (of type B) and returning response (of type T) /// </summary> public IEnumerator InvokeApi<B, T>(string apiName, Method httpMethod, B body, Action<IRestResponse<T>> callback = null) where T : new() { string url = ApiUrl(apiName); Debug.Log(httpMethod.ToString() + " custom API Request Url: " + url); ZumoRequest request = new ZumoRequest(url, httpMethod, true, User); request.AddBody<B>(body); yield return request.Request.Send(); request.ParseJson<T>(callback); }

but appear to not receive the body under the req in the get request on easy api. is there an example of something i can do here, any help would be greatly appreciated. Thanks

@deadlyfingers
Copy link
Contributor

deadlyfingers commented Mar 10, 2018

@Reddevildragg so in the case you mention that is for a custom API which is for EASY APIs. In this case you can send up a body as one type of object B, and receive the same type or a different object type T in the response.
The closest example of EASY APIs (using the one object type) is:
https://github.com/Unity3dAzure/AppServicesDemo/blob/master/Assets/Scripts/HighscoresDemo.cs#L317
Does that help? Or would it help better to add this functionality to the demo?

@Reddevildragg
Copy link
Author

Hi there. I was able to figure it out in the end with a bit of trial and error. It may be nice to have an example just incase people come across this in the future.
Thanks for the response.

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