grimmy
August 7, 2017, 11:46am
1
I am considering implementing a system like Gumroad for license administration in my end software but to communicate with it’s API I need to send cURL commands such as:
curl https://api.gumroad.com/v2/licenses/verify
I notice a number of other similar organisations to Gumroad also all seem to use cCURL to access their apis (SendOwl for example)
It seems quite important so how on earth do I do this from Unity?
Thanks
It doesn’t have to be cURL. What you need to do is to send a POST request to this API endpoint with the right data.
IEnumerator Upload()
{
WWWForm form = new WWWForm();
form.AddField("myField", "myData");
using (UnityWebRequest www = UnityWebRequest.Post("https://api.gumroad.com/v2/licenses/verify", form))
{
yield return www.SendWebRequest();
if (www.isNetworkError || www.isHttpError)
{
Debug.Log(www.error);
}
else
{
Debug.Log("Form upload complete!");
}
}
}
You can download a tool called Postman to simulate requests.