How do I use negation (and lists) in JIRA REST API? - jira-rest-api

I need to recreate a JIRA search filter in JIRA REST API.
I understand how to query for particular field values with "jql for REST", e.g.
curl -D- -u fred:fred -X GET -H "Content-Type: application/json" http://kelpie9:8081/rest/api/2/search?jql=assignee=fred&startAt=2&maxResults=2
But how do I represent this piece of query:
... AND (labels not in (label1, label2) OR labels is EMPTY) AND ...
Or maybe there is a way to reuse an existing filter instead of constructing the JQL query?

Ok, I just realized that when I construct the JQL query in JIRA, I can see the modified "ulr-ready" version of the query in the browser address bar. Facepalm.

Related

Getting tweet replies to a particular tweet from the tweet author

I am trying to get tweet replies for a particular Tweet/TwitterThread that are just from the author of the Tweet only. So far, I am able to get all the replies for a particular Tweet by using the search endpoint like this:
curl --request GET --url 'https://api.twitter.com/2/tweets/search/recent?query=conversation_id:1373848915464785920&tweet.fields=in_reply_to_user_id,author_id,created_at,conversation_id' --header 'Authorization: Bearer $BEARER_TOKEN'
The code above gives me ALL the replies. What I want is only the replies from the original author.
For reference, this is the documentation link for the code above: https://developer.twitter.com/en/docs/twitter-api/conversation-id
You can specify the author in the query with "(from:mark)" assuming the username is mark. Say the following is the query: "apples -filter:replies"
Then, the following would be the query including the author of the tweet: "apples (from:mark) -filter:replies"

How to personalise email on infobip

Please how can I add custom placeholder to the portal editor for infobip email service.
I have created a template with the portal design editor and I want to dynamically add placeholders like the recipients first name or the recipients and invoice ID or any other necessary data concerning the recipient, I'm trying to create an invoice email for my customers.
From the API documentation, I have seen the place to pass in the template ID but I'm not seeing any place where I can pass in my own custom variables for the custom recipient data. so please help if there is any and thanks.
Easiest way would be to define placeholders in the template you save. Like this: {{customer_name}} {{invoice_no}} and then when you use the template Id in API request you would have to send via API something like this:
curl --location --request POST 'https://api.infobip.com/email/2/send' \
--header 'Authorization: Basic Authorization==' \
--form 'templateID="Your_template_id"' \
--form 'to="{
\"to\": \"Customer1#customer1.com\",
\"placeholders\": {
\"customer_name\": \"Customer 1\",
\"invoice_no\": \"1\"
}
}
"' \
--form 'to="{
\"to\": \"customer2#gmail.com\",
\"placeholders\": {
\"customer_name\": \"*customer 2\",
\"invoice_no\": \"2\"
}
}"'
I have been using as EmailJs before. Their integration is extremely simple and straight forward.

JIRA API GET all values for a custom field

I'm trying to get all possible values for a customfield on JIRA through the GET api.
Example:
I created the "Test API" custom field and gave it three values "API 1", "API 2" and "API 3". The id for this field is 18232.
I'm trying to do this with the following:
https://my-domain.atlassian.net/rest/api/2/customFieldOption/18232
I got this from here
The headers are one for basic authorization and one with Accept - application/json
No matter what I try to do I keep getting the error
{"errorMessages":["A custom field option with id '18232' does not exist"],"errors":{}}
Has anyone been sucessful with this?
I have followed the following and I was able to get what I was looking for, hope this helps!
Request:
curl -D- -u username:password -X GET -H "Content-Type: application/json" https://my-domain.atlassian.net/rest/api/2/customFieldOption/10150
Response:
{"self":"https://my-domain.atlassian.net/rest/api/2/customFieldOption/10150","value":"AUG-1999"}
Hope this helps!
That rest API call only give you a custom field OPTION value, if you want to list all options of customFileld i think you need a webserviceplugin.

delete property of event keen.io

Is there a way to delete a property of an event?
e.g. I have an event called Log which has a two properties X and Y
I wanted to delete X
If this cannot be done can I edit the values of X for event Log?
I have been unable to find anything online
Take a look here at the API Docs. Have you tried sending a DELETE to https://api.keen.io/3.0/projects/PROJECT_ID/events/Log/properties/X or something along those lines? This will delete the property from all events in the collection.
You can delete just a certain property or particular properties from your Event Collection as shown here: https://keen.io/docs/api/#delete-a-property.
While in some cases you may want to delete erroneous or errant data, in other cases especially where you are not actively using and querying the data it is OK to leave the property there. It will appear in your historical data, but just don't continue to send the property in for future data points. There is a generous limit on the number of unique properties (1,000 unique properties) allowed per event as well as a large size limit on individual events as well (~1MB).
I’d recommend running an extraction of the exact same query first (https://keen.io/docs/api/#extractions) to get a preview of what you’re about to delete. That way you’ll also have successfully created a backup of that data as well.
Here's a sample CURL command for deletes for a particular property - use COLLECTION_NAME and PROPERTY_NAME to identify the property that you want to remove from your particular event collection. Of course, replace PROJECT_ID, COLLECTION_NAME, and MASTER_KEY placeholders with your own.
$ curl https://api.keen.io/3.0/projects/PROJECT_ID/events/COLLECTION_NAME/properties/PROPERTY_NAME \
-H "Authorization: MASTER_KEY" \
-H "Content-Type: application/json" \
-X DELETE

Get asana tasks in project with assignee information

I am trying to retrieve asana tasks within a project. I would like to retrieve assignee information in the same query. I tried this query and got assignee id:
curl -u <key>: "https://app.asana.com/api/1.0/projects/<project-id>/tasks?opt_fields=name,created_at,assignee
I want get assignee name. So I include "opt_expand=assignee":
curl -u <key>: "https://app.asana.com/api/1.0/projects/<project-id>/tasks?opt_fields=name,created_at,assignee&opt_expand=assignee
I still don't get assignee name. What's the way to do this?
Thanks
(I work at Asana)
The interplay between opt_fields and opt_expand is actually a bit complicated, we should clarify in the documentation. The latter ends up superseded by - not additive with - the former.
The best way to achieve what you want would be to NOT use opt_expand and to add assignee.name to the list of fields in opt_fields.