Skip to main content

Hi,
So I am implementing a new rest API into my process, I have created and configured the swagger discriptor, however when I pass just the Authorization into the header, I get error 415. If I try to pass in the content-type as another header parameter I get error 400.
Can anyone help out and explain to me what I am doing wrong.
Thanks.

Hi,



Have you tried using Postman to test your REST API first?


 


Just a tip. Usually if I am having trouble with the REST service broker in K2, I will just install Fiddler, and configure the K2HostServer.exe.config to use Fiddler as a proxy. That way any request and response to your REST service will be recorded in Fiddler. To do this, you have to


 



  1. Install Fiddler on your K2 server

  2. Open Fiddler > Tools  > Options > Connections

  3. Make sure "Allow remote compturs to connect" is checked

  4. Take note of the port number, and close the options window

  5. Create a backup of your K2HostServer.exe.config

  6. Edit your K2HostServer.exe.config

  7. Add the following line under <system.net> tag. If you do not have such tag in your config file, then add add the entire <system.net> section before the </configuration> tag near the end of the config file. Replace the port number accordingly.


     <system.net>
    <defaultProxy enabled="true">
    <proxy bypassonlocal="true" proxyaddress="http://localhost:<fiddler port>/" />
    </defaultProxy>
    </system.net>


  8. Save the changes, open your Fiddler, make sure Fiddler is running, and restart your K2 service.

  9. Now test your REST service from within K2 again, and you should see requests to your REST service being logged in Fiddler. Using Fiddler, you can inspect the request and response, and find out what is wrong.


 


Reply