Question Convert curl into vb.net

bluezap

New member
Joined
Oct 31, 2015
Messages
4
Programming Experience
5-10
Here is what I need to convert
VB.NET:
 curl https://api.gumroad.com/v2/licenses/verify
  \ -d "product_permalink=QMGY"
  \ -d "license_key=YOUR_CUSTOMERS_LICENSE_KEY"
  \ -X POST


Here is the response I need to react to


VB.NET:
 {
  "success": true,
  "uses": 3,
  "purchase": {
    "id": "OmyG5dPleDsByKGHsneuDQ==",
    "product_name": "licenses demo product",
    "created_at": "2014-04-05T00:21:56Z",
    "full_name": "Maxwell Elliott",
    "variants": "",
    "refunded": false,
    # purchase was refunded, non-subscription product only
    "chargebacked": false,
    # purchase was refunded, non-subscription product only
    "subscription_cancelled_at": null,
    # subscription was cancelled,
    subscription product only
    "subscription_failed_at": null,
    # we were unable to charge the subscriber's card
    "custom_fields": [],
    "email": "maxwell@gumroad.com"
  }
}
 
It is a POST request with form data. You can for example use WebClient:
        Dim web As New Net.WebClient
        web.Headers.Add(Net.HttpRequestHeader.ContentType, "application/x-www-form-urlencoded")
        Dim data = "product_permalink=QMGY&license_key=YOUR_CUSTOMERS_LICENSE_KEY"
        Dim response = web.UploadString("https://api.gumroad.com/v2/licenses/verify", data)
 
Thank you so much for this.

So I used -
VB.NET:
 Dim web As New Net.WebClient
        web.Headers.Add(Net.HttpRequestHeader.ContentType, "application/x-www-form-urlencoded")
        Dim data = "product_permalink=fTbz&license_key=11BB81E6-762G4853-967A7CD1-20630734"
        Dim response = web.UploadString("https://api.gumroad.com/v2/licenses/verify", data)
Could I please know how I correspond the the terms "success" and "uses" to an action.

If "success=true" I want form1.show()
and if "uses" > 2 I want end()
 
Use a Json library (f.ex JSon.Net) to read the response. Ask in a new thread if you have problems reading json data.
 
Back
Top