ellucian-developer / integration-sdk-csharp

C-Sharp framework for interacting with Ethos Integration.
MIT License
9 stars 3 forks source link

Passing Content-Type with PostAsync #3

Open SamuelOhrenberg-OCCC opened 6 months ago

SamuelOhrenberg-OCCC commented 6 months ago

Hello, all

I am just now getting started trying to use this in a C# app that I am building for my institution. I am trying to send a POST request to person-matching-requests to initiate the creation of a new person in our Colleague instance. However, I am getting a 404 error in my request because the Content-Type of the request being sent is "application/json" and the endpoint requires it be set to "application/vnd.hedtech.integration.person-matching-requests-initiations-prospects.v1+json".

Is it possible to force that Content Type to be updated via this library?

Example of the request in Fiddler

tone711 commented 2 months ago

You can pass headers into the PostAsync() method.

PostAsync( Dictionary<string, string> headers, string url, string body = "" )

Something like:

Dictionary<string, string> customHeaders = new Dictionary<string, string>(); customHeaders .Add("Content-Type", "application/vnd.hedtech.integration.person-matching-requests-initiations-prospects.v1+json" );

PostAsync( customHeaders , ...