Struggling with License Update in API with .net
-
hi – firstly neat plugin. Love it.
I’m developing a .net library for this. Have implemented all the GET operations without a hitch. However, I’m struggling to interface with the API for PUT operations (and possibly, by extension, POST). I’m getting a http 404 error from the server, despite the license key being right. I don’t know if you work with .net, but some code:
Public Function HttpPut(netquery As String, json As String) As WebClientResponse Dim response As New WebClientResponse Using client As New CustomWebClient(WebClientTimeout) With client .Encoding = Encoding.UTF8 .Credentials = Credentials .Headers(HttpRequestHeader.ContentType) = "application/json" End With With response .ReturnedString = client.UploadString(netquery, "PUT", json) .Success = True End With End Using Return response End Function
CustomWebClient is just an extension allowing custom time outs. Credentials are exactly the same as for the working GETs. The content of
netquery
is right (same as the successful GETS). The client.UploadString params:netquery (with changes to preserve security):
https://mysite.com/wp-json/lmfwc/v2/licenses/OGZL-3DDTF-8HTFS-SQET5-0MQ2E-87TFS
json:
{"id":4,"orderID":224,"productID":205,"LicenseKey":"OGZL-3DDTF-8HTFS-SQET5-0MQ2E-87TFS","ExpiresAt":null,"ValidFor":null,"Source":"1","Status":3,"TimesActivated":1,"TimesActivatedMax":2,"RemainingActivations":null,"CreatedAt":"2021-04-28T10:37:39","CreatedBy":1,"UpdatedAt":"2021-06-15T18:06:19","UpdatedBy":1}
Difficulty being, I only have the HTTP error to go on so it’s hard to figure what’s going on with the API. Could you assist?
- The topic ‘Struggling with License Update in API with .net’ is closed to new replies.