Skip to content
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

Creating license from API #21

Open
kovrobert opened this issue May 3, 2019 · 2 comments
Open

Creating license from API #21

kovrobert opened this issue May 3, 2019 · 2 comments

Comments

@kovrobert
Copy link

Dear Developer,

please create an update on the project. Especially on the licensemanager. In the license class the category field does not exist but in the snipeit. This will lead to an error if you try to create a license.

Is that possible that you will update all the endpoint models? It would be great.

Thank You:
Robi

@gnh1201
Copy link

gnh1201 commented Dec 11, 2019

Unfortunately, I modified SnipeSharp's JsonProperty but couldn't solve this problem.
So I implemented it myself using RestSharp and succeeded in creating it.

var client = new RestClient(ApiUrl);
var request = new RestRequest("/licenses", Method.POST);
request.RequestFormat = DataFormat.Json;
request.AddHeader("Accept", "application/json");
request.AddParameter("name", software.DisplayName);
request.AddParameter("seats", 1);
request.AddParameter("category_id", 1);
if(manufacturer != null) {
    request.AddParameter("manufacturer_id", manufacturer.Id);
}
if (company != null)
{
    request.AddParameter("company_id", company.Id);
}
client.AddDefaultHeader("Authorization", string.Format("Bearer {0}", AccessToken));
client.Execute(request);

@gnh1201
Copy link

gnh1201 commented Dec 17, 2019

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