REST - singleton aspect

If you have questions or if you want to share your opinion about Aware IM post your message on this forum
Post Reply
ACDC
Posts: 1135
Joined: Sat Jun 30, 2007 5:03 pm
Location: California, USA

REST - singleton aspect

Post by ACDC »

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 ?.
Last edited by ACDC on Fri Sep 01, 2023 9:10 pm, edited 1 time in total.
PointsWell
Posts: 1450
Joined: Tue Jan 24, 2017 5:51 am
Location: 'Stralya

Re: REST - singleton apect

Post by PointsWell »

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.
ACDC
Posts: 1135
Joined: Sat Jun 30, 2007 5:03 pm
Location: California, USA

Re: REST - singleton apect

Post by ACDC »

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.
Not sure I understand ,could you expand on this
The singleton aspect is only related to the definition of the REST call, it can be parameterised.
same goes for this


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
PointsWell
Posts: 1450
Joined: Tue Jan 24, 2017 5:51 am
Location: 'Stralya

Re: REST - singleton apect

Post by PointsWell »

You can build up the API call using objects that are in context.

Eg

Code: Select all

api.made up company.com/apikey?id=<<customer.id>>&name=<<customer.name>>
There’s a tutorial on REST on YouTube using the Weather.com app I built a few years ago.
BobK
Posts: 542
Joined: Thu Jan 31, 2008 2:14 pm
Location: Cincinnati, Ohio, USA

Re: REST - singleton apect

Post by BobK »

ACDC wrote: Fri Sep 01, 2023 1:00 am The AwareIm REST setup must be a singleton, which means it's a single-user-only
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
ACDC
Posts: 1135
Joined: Sat Jun 30, 2007 5:03 pm
Location: California, USA

Re: REST - singleton apect

Post by ACDC »

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.
I am still confused

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
BobK
Posts: 542
Joined: Thu Jan 31, 2008 2:14 pm
Location: Cincinnati, Ohio, USA

Re: REST - singleton apect

Post by BobK »

ACDC wrote: Fri Sep 01, 2023 4:42 pm 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.
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
ACDC
Posts: 1135
Joined: Sat Jun 30, 2007 5:03 pm
Location: California, USA

Re: REST - singleton apect

Post by ACDC »

So you got the REST service working and you are now concerned with possibly sending multiple invoices and the same time, correct?
Yes I want to prevent a collision
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?
No, it is purely to set the 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 :lol:
Post Reply