The AwareIm REST setup must be a singleton, which means it's a single-user-only
How could I have multiple users posting Invoices to a REST-based accounting API. It seems this is not possible with the standard configuration.
Any suggestions on how to get some degree of multi-user functionality within the REST setup?
I understand that non-persisted objects can only be seen by the user creating them. Would this be an option i.e. set the Rest Objects as Non-Persisted ?.
REST - singleton aspect
REST - singleton aspect
Last edited by ACDC on Fri Sep 01, 2023 9:10 pm, edited 1 time in total.
-
- Posts: 1470
- Joined: Tue Jan 24, 2017 5:51 am
- Location: 'Stralya
Re: REST - singleton apect
The REST instance is a singleton but (from memory) you could use multiple different user/tenant keys stored in a user or a tenant record.
The singleton aspect is only related to the definition of the REST call, it can be parameterised.
The singleton aspect is only related to the definition of the REST call, it can be parameterised.
Re: REST - singleton apect
Not sure I understand ,could you expand on thisThe REST instance is a singleton but (from memory) you could use multiple different user/tenant keys stored in a user or a tenant record.
same goes for thisThe singleton aspect is only related to the definition of the REST call, it can be parameterised.
In both a Get and a POST, the REST Objects in Context are predefined in the Service that is being called , not sure how this can be parameterised.
I am referring to a single tenant with multiple users on the same API key
-
- Posts: 1470
- Joined: Tue Jan 24, 2017 5:51 am
- Location: 'Stralya
Re: REST - singleton apect
You can build up the API call using objects that are in context.
Eg
There’s a tutorial on REST on YouTube using the Weather.com app I built a few years ago.
Eg
Code: Select all
api.made up company.com/apikey?id=<<customer.id>>&name=<<customer.name>>
Re: REST - singleton apect
Wrong. A singleton means there is only 1 actual object in the database for this BO.
If your REST service is defined in a BO called MyRestSevice, you need to create 1 MyRestService in the DB. AwareIM will not let you create more than 1.
When calling the REST Service using REQUEST SERVICE, the data being passed to the service can came from almost anywhere.
Bob
Re: REST - singleton apect
I am still confusedWrong. A singleton means there is only 1 actual object in the database for this BO.
If your REST service is defined in a BO called MyRestSevice, you need to create 1 MyRestService in the DB. AwareIM will not let you create more than 1.
Picture this:
There are 4 users working for the same company, logged into a single tenant app "Sales Invoicing", each one creates an Invoice at roughly the same time and then needs to Post the Invoice to the Accounting REST API.
I currently have this working, but the invoices are queued and batch-processed individually at the end of the day
How can I make this process real-time so invoices are processed at the time of creation? Going through a single Rest configured object does not seem possible
Re: REST - singleton apect
So you got the REST service working and you are now concerned with possibly sending multiple invoices and the same time, correct?
Are you using the BO that has the REST service defined and is a singleton to store the data to be sent via the REST service?
If so, you do not need to do that.
Bob
Re: REST - singleton apect
Yes I want to prevent a collisionSo you got the REST service working and you are now concerned with possibly sending multiple invoices and the same time, correct?
No, it is purely to set the serviceAre you using the BO that has the REST service defined and is a singleton to store the data to be sent via the REST service?
I am creating the REST Invoice from the Current Invoice and then calling the service. It seems I must reference the REST invoice with the current Invoice ID and then bring that Rest Invoice into Context before calling the service -
I have this mindset that there can only be one REST invoice that exists during the POST event.. but not so. Multiple calls can be made providing the right ID is in context.
Okay I am slowly getting it, thank you