App Platform: Send non JSON payloads

Hello again :slightly_smiling_face:

I am writing a small project to let users check the PI filter validity in the system. It’s going to be a simple table which displays and links to each PI and tells the user if the filter is valid or not.

DHIS2 sends a POST request with the filter text to the programIndicators/filter/description endpoint (not JSON). I thought I would give this ago with app platform style post requests, but these seem to only accept content type JSON. Is there a way to change the content type?

Many thanks in advance!
Pete

Hi Peter, good to see you here.

We have some scripts in python to do validations and checking PI expressions and filters is one of them. It is possible that we are not validating everything that has to be validated, but maybe we can cooperate on this :slight_smile:

1 Like

Hi Manu! Hope you are doing well, that seems like a very useful tool! I actually already have a script to do this in python though, my specific issue is with trying to use the DHIS2 App platform’s useMutation react hook :frowning:

@plinnegan we would need to add a matcher for the programIndicators/filter/description endpoint here - app-runtime/textPlainMatchers.ts at master · dhis2/app-runtime · GitHub (PRs welcome, or open a jira issue with the app-runtime component in the LIBS project and we’ll get to it when we can :slight_smile: )

cc @hendrik

2 Likes

@tracker-backend we should also migrate this endpoint to accept JSON

1 Like

Jira issue for backend JSON support : DHIS2-11871
Jira issue for app-runtime support for Text content-type : LIBS-232