Hi Paul,
That is the correct way to specify HTTP headers. There are a couple of other things worth mentioning from your example:
- GET is the default method, so you don't need to specify it, unless you overrode the default in an interceptor.
- the query string should be defined by the params object. It will automatically URL encode the values for you.
So your request could look like:
var reqParams = { path: 'https://projects.commercialservices.com/rest/api/2/search',
params: {
jql: '"Freshservice Tickets" ~ "#' + ticketId + ' "'
}
}
I find this easier to read, plus, if ticketId includes any URL unsafe characters, they will be encoded correctly.
-Scott
PS. It's uncommon to provide a
Content-Type for a GET request since there is no entity. Did you mean
Accept instead? The
MIME Interceptor is your friend.