panoramicdata / ServiceNow.Api

ServiceNow REST API nuget package
MIT License
21 stars 18 forks source link

Added missing ResourceLinkConverter #22

Closed MattJam87 closed 3 weeks ago

MattJam87 commented 11 months ago

These changes should fix the annoying bug related to the missing ResourceLinkConverter mentioned in the original source code comments, but nowhere to be found in the code.

KKSatish commented 1 month ago

I think it should be merged. Resource Link converter is missing from main branch

TheCakeMonster commented 3 weeks ago

@MattJam87 @KKSatish I have published a new version of the package containing the first implementation of this new converter. However, I am not able to fully test writing to the server at the moment, and I suspect that the WriteJson method might need more work for the creation of new objects to work when links are added. If you are able to test this aspect then that would be very helpful.

I suspect we will also find some other objects whose definitions need to be updated to support resource links.

KKSatish commented 3 weeks ago

@TheCakeMonster Thanks for publishing the package we could see the same on Nuget. Actually, I have one more request for you for the following issue. https://github.com/panoramicdata/ServiceNow.Api/issues/21

I already have a fix. However, I need to use rest client for the same. somehow it's not working with Http. Can you please have a look at the following code, if you are happy with the code, I can create a branch and PR for the same.

////sample code.. var options = new RestClientOptions("") { MaxTimeout = -1, }; var client = new RestClient(options); var request = new RestRequest("https://{your_instance}.service-now.com/api/now/attachment/upload", Method.Post); request.AddHeader("Accept", "application/json"); request.AddHeader("Authorization", "Bearer {your bearer token}"); request.AlwaysMultipartFormData = true; request.AddParameter("table_name", "{table name}"); request.AddParameter("table_sys_id", "{table sys Id}"); request.AddFile("uploadFile", "/path/to/file"); RestResponse response = await client.ExecuteAsync(request); Console.WriteLine(response.Content);