I'm using NestJS to build an API REST. I have several endpoints and each one must have two #Query() params.
My question is: there's a way to assign or create this params without adding on each endpoint individually?
Related
I want to create an API in the Strapi. When this API hits, it will fetch data from another API service and store the strap as well. Later when I use this Strapi API I will use the previously retrieved data.
I found a documentation about external data, but the example here is hard to fully understand
https://docs.strapi.io/developer-docs/latest/guides/external-data.html
This is how you can do that in a Strapi.
Create a new model to store external API then add a new controller with those steps:
Check if requested data is present in database (using an unique ID or any way to identify the data for example)
If data exists, return it
If not, use 'axios' (installed with Strapi) or 'request' to fetch the external API
Store the fetched data
Return the fetched data
I'm working for a project which has multiple microservices. For Ex: AuthenticationService (Only to get authentication token), UserService(Get All Users with token), InventoryService(To get the inventory data with token) etc. GraphQL API Gateway is used to get the token or inventory. Now when i want to get the list of the inventory which is based on user then i'm not sure that whether i should use RabbitMQ or Axios API Call.
I'm sharing 3 diagrams. Please help to get the some clarity.
Image 1:
Image 2:
Image 3:
I personally used image one in our project, because for contacting internally you don't need to pass requests through the gateway.
use the api gateway as an endpoint of your application.
I recommend using #golevelup/nestjs-rabbitmq npm package because it is easy to use.
if it is useful plz vote up :)
My InvokeRESTAPI displays the following if executed:
I can see a Response field printed that is empty.
Can I somehow use this to get a value back from the API reply and use it to call another template with it?
On the task itself I am using this parameter:
successCriteria: eq(root["status"], "successful")
So I would assume that if there is some custom success criterion then I would be able to use a value from the response in order to define it.
Based on your screenshot, you are using the API to post the json content to Azure Logic App workflow.
So you need to add the Response Action in Azure Logic App to add response content to the work flow.
Here are the steps:
In Logic App:
Then when you run the API in Invoke Rest API task, it will show the customer response.
For more detailed info, you could refer to this doc: Construct the response
I have developed a web service which is receiving queue of messages through RabbitMq. This message contains userid which has to be passed as query string to a third-party api.
Example of third-party api :
(eg: "https://api.example.com/user?userId='')
Web service has to call the api with userId received through message queue. Probably the service receives N number of messages within a second.
I Need best possible way to accomplish the scenario given above.My approach is as follows:
Push the userid into an array.
Iterate through the userid using array.map() method by passing api call as callback param.
Once the api response is received for an element, remove the element from array using array.shift() method.
Is there any better approach?
I am not sure if this is an option. I require it badly, and cannot find any references of it.
When integrating between an HTTP Triggered Azure Function within your Logic App flow, you are requested to pass a body object for the function to digest:
I am hoping for a way to customize the Request Body inputs, to make it have a strict template structure, in and out.
In:
Out:
(The function returns an Object)
Is there any way I can achieve this?
You could create a Logic Apps Custom Connector.
You can create one of these from a Postman collection or using an OpenAPI definition. You can get hold of the OpenAPI definition from the Function App.
With a custom connector, you have a bit more control over the request and response. This will allow the users of your connector to provide inputs when used in a Logic App and also receive tokens from the response. These can then be used in further Logic App steps.
Just hard coded it to the fields I require it using the Logic App syntax and it responds to satisfaction
#{body('function-name')?['property']}
Haven't tried the Custom Connector