kontent-ai / delivery-sdk-net

Kontent.ai Delivery .NET SDK

Home Page:https://www.nuget.org/packages/Kontent.Ai.Delivery

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add possibility to Post (instead of Get)

Domitnator opened this issue · comments

Brief bug description

We use Webhooks to update our Azure Search index. Right now the client has done some heavy content re-ordering and is publishing a lot of content items at the same time. The incomming webhook therefor has a lot of changes. To retrieve the content of all those changed items we do a "simple" query based on the codenames. In example:

https://deliver.kontent.ai/xxxxx-xxxxx-xxxx-xxxxx/items?system.codename[in]=Codename1,Codename2,Codenam3

But this goes up to 700 codenames so we are getting a "URI Too long" exception from the devlivery API.

I went trough the docs but i do not see a way to force the delivery API to use Post instead of Get. Am i overseeing something in the docs?

Repro steps

Make a request which exceeds the max URL characters

Expected behavior

Provide a possibility to use Post instead of GET

Test environment

  • Latest SDK (version 17.4.0)
  • .Net core 6
  • Windows

Additional context

Add any other context about the problem here.

Screenshots

image

Hi @Domitnator.
Answering your question. As it's written in this StackOverflow discussion, it's not possible to simply use POST request to API instead of GET, if API controller doesn't support it.
Currently, ItemsController of DeliveryAPI supports only GET requests, so we cannot simply implement your suggestion as we are not allowed to change API behavior within the GitHub issues.
You can:

and our Production team will investigate it.

At the moment I can suggest you to split your long request into several shorter ones and then join responses.

Also, you can probably consider using our new experimental feature SyncAPI instead of using Webhooks. Currently, SyncAPI is available only through delivery-sdk-js (JavaScript SDK), but we are working on adding SyncAPI support to deliver-sdk-net too (#371)

I hope my answer will be useful for you.