- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hey everyone,
I am a first time plugin developer in the final stages of submitting my plugin to the Store. Currently the issue is that neither I, nor the tester at Autodesk, are getting a valid response from the entitlement server upon request. I have looked into the error, and I am not sure what is going wrong. It looks like there is an error when I try to access the webservices/checkentitlement, it doesn't seem to be finding that URL. I have attached a screenshot of what shows when I examine the response when debugging. The ResponseUri is "https://apps.autodesk.com/Error/ServerError?aspxerrorpath=/webservices/checkentitlement%22". As I am very new to all of this, I basically just copied over the code from the Autodesk Entitlement document and changed the relevant areas. I am using the RestSharp library as Autodesk suggests. The error actually occurs at the "EntitlementResponse entitlementResponse = deserial.Deserialize<EntitlementResponse>(response);" line, when I try to deserialize the response from Autodesk.
My relevant code is below and I have also attached images of the error that I get when opening the plugin and the results when I examine the response during debugging in Visual Studio.
public const string _baseApiUrl = @"https://apps.autodesk.com/";
public const string _appId = @"<my plugin id here, I have checked this multiple time, I don't think this is the issue>";
private bool CheckEntitlement(string appId, string userId)
{
var client = new RestClient();
client.BaseUrl = new System.Uri(_baseApiUrl);
// Set resource/end point
var request = new RestRequest();
request.Resource = "webservices/checkentitlement";
request.Method = Method.GET;
// Add parameters
request.AddParameter("userid", userId);
request.AddParameter("appid", appId);
// (2) Execute request and get response
IRestResponse response = client.Execute(request);
// (3) Parse the response and get the value of IsValid.
bool isValid = false;
if (response.StatusCode == HttpStatusCode.OK)
{
RestSharp.Serialization.Json.JsonDeserializer deserial = new RestSharp.Serialization.Json.JsonDeserializer();
EntitlementResponse entitlementResponse = deserial.Deserialize<EntitlementResponse>(response);
isValid = entitlementResponse.IsValid;
}
return isValid;
}
[Serializable]
public class EntitlementResponse
{
public string UserId { get; set; }
public string AppId { get; set; }
public bool IsValid { get; set; }
public string Message { get; set; }
}
Thanks in advance for any help, I'm really stumped on this one.
Solved! Go to Solution.