How to put an Object parameter on Route

Asked

Viewed 22 times

0

I’m creating a way to send firebase push notification.

There’s three pieces of information I need to pass along: string title, string body and object data

When I started doing it, I did it like this [Route("controller/{title}/{body}")] and for my fault, I forgot to put the object data on Route as well. And that’s when my doubt arose.

How do I put on Route a parameter of the type object?

Method:

public async void EnviarPushNotification(string title, string body, object data) { ... }

Example Date:

data: {
   action: "Play",
   playerId: 5
}

Edit

At this link, shows that there is a payload with the data, but does not show the options that can be used in it

In this other link, shows several key: value, but not about the data


I was able to understand what are the possible items of data, are customized that I can create on my firebase console: inserir a descrição da imagem aqui

  • would it be better if you received the date by request if you made a POST to endpoint, but you cannot type this Object? create a class for them, would make the post and parse much simpler ;)

  • so, I thought about it, but I haven’t found what are all the possibilities that can go within the date yet, in the example I put up I quoted the action and the playerId, but I believe it’s not just them... I’m still looking for which Keys he accepts... So I wanted to know if there is another way to do other than by POST and create a class and such... Because then I don’t need to fix the data in it

  • @Ricardopunctual I put some edits in the publication of doubt and I understood which are the key value, that in reality it is I who create even... Thanks for the help

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.