Hi Manoj,
Thank you for your observation.
I did not ask this before the PR was raised, because I didn’t even think it
could be a problem, as this is not the first time we use this approach. Beside
the external-ids that Adam mentioned, there is an API set implementing an open
banking standard, which was added 5 years ago. You can check InteropApiResource
in the interoperation package. Since a public specification is using the
secondary identifiers the same way: parties/{idType}/{idValue}/{subIdOrType} I
thought we can follow this pattern.
Short-name for jobs is like a secondary identifier, the request fails if the
resource is not found (filter would return empty result), just like {id} this
API always returns one result (filter could return more).
I know that there is a saying that there should only exist one URI to refer to
a single resource, but there is no total agreement on this.
I am open to discuss.
Thank you,
Marta
> On 29 Aug 2024, at 17:36, Manoj VM <[email protected]> wrote:
>
> Hi Marta,
>
> This is a good Idea to have static names for jobs, Thanks for adding this.
>
> I have one suggestion though.
>
> The API paths mentioned above are not correct according to the REST API
> guidelines. The `short name` is not a resource under jobs, instead it is
> another field. So it should not be part of the path.
> For example, The right way to access a resource by a field other than primary
> key is by using a query parameter and not by the path.
> ie, the right GET API would be GET /v1/jobs?shortName={shortName}
>
>
> Thanks and Regards,
> Manoj Mohanan
> <http://fynarfin.io/>
>
>
> On Thu, Aug 29, 2024 at 7:47 PM Arnold Galovics <[email protected]
> <mailto:[email protected]>> wrote:
>> Hi Marta,
>>
>> I like the idea of having a short name for the jobs, thanks for that.
>>
>> Would it be possible though to generate some default short names from the
>> jobs' regular names automatically instead of writing custom liquibase
>> scripts?
>>
>> Thanks.
>> Best,
>> ARnold
>>
>> On Thu, Aug 29, 2024 at 4:12 PM Márta Jankovics <[email protected]
>> <mailto:[email protected]>> wrote:
>>> Hi All,
>>>
>>> I would like to notify you that with this PR
>>> https://github.com/apache/fineract/pull/4037 a new mandatory, length 8,
>>> unique field: short_name was added to the job table.
>>> This is great because now we have an identifier for the jobs, which are not
>>> auto-incremented, and are static, regardless how the system has been
>>> initialised.
>>> You are now able to use this new field, instead of the primary key, to
>>> address the jobs in all known job related API endpoints.
>>>
>>> GET /v1/jobs/short-name/{shortName}
>>> GET /v1/jobs/short-name/{shortName}/runhistory
>>> POST /v1/jobs/short-name/{shortName}
>>> PUT /v1/jobs/short-name/{shortName}
>>>
>>> I’ve filled this new field for the existing jobs. But if you have a custom
>>> job, which is not contributed back to the community, then you should
>>> specify the short_name, and add it to the liquibase script.
>>>
>>> The short_name has a naming convention. First part is like a namespace,
>>> second part is specific for the job, separated by _.
>>> Example: ACC_AATR (Add Accrual Transactions)
>>>
>>> Top namespaces:
>>> LA: Loan Account
>>> SA: Savings Account
>>> SH: Shares
>>> ACC: Accounting
>>> STI: Standing Instruction
>>> EM: Email sending
>>> SMS: Sms sending
>>> BDT: Business Date
>>> COM: Commands
>>> EXE: External Events
>>>
>>> Thank you,
>>> Marta