I've a Util.ts which will have all the API endpoints.
In my component will import the Api class and make use of the API's.
Now, One of the API endpoint is having dynamic values, that I need to append to the URL.
Utils.ts
export class Api {
public static PROGRESS_ISSUE = 'https://xxx/rest/api/2/search?jql=project%20%3D%2025764%20AND%20status%20%3D%20%22In%20Progress%22&fields=id,key,status,project&maxResults=100'
}
In the above, I wanted to make the project & status as dynamic values which I'll be passing in the service.
Service.ts
import { Api } from './api/utils';
getJiraOpenIssues(id: number, status:string) {
return this.http.get<any>( Api.PROGRESS_ISSUE )
.subscribe(count => console.log(count.total));
}