Jira Api Error when creating issue - jira

On my website I have a contact form which when submitted, creates a new service desk ticket. It makes the following rest api call:
https://jira-housters.atlassian.net/rest/servicedeskapi/request (with appropriate Accept and Authorization request headers)
{
"serviceDeskId": "1",
"requestTypeId": "1",
"requestFieldValues": {
"summary": "Housters Contact from Justin Test (Web)",
"description": "test message"
},
"raiseOnBehalfOf": "myemail#mydomain.com"
}
Before this worked completely fine, however a few days ago it started erroring:
{"errorMessage":"Your request could not be created. Please check the fields have been correctly filled in. Please provide a valid value for field 'Raise this request on behalf of'","i18nErrorMessage":{"i18nKey":"sd.validation.request.creation.failure.required.field","parameters":["Please provide a valid value for field 'Raise this request on behalf of'"]}}
This makes no sense, as it's complaining about the raise request on behalf of field when I clearly have it specified. What gives?

raiseOnBehalfOf should have the customers accountId not email.
You can create a customer using:-
-> https://your-domain.atlassian.net/rest/servicedeskapi/customer
-> Get the accountId from the response.

Related

unable to get given_name and family_name from azure v2 token endpoint

In the manifest of my application registration I've configured to retrieve the given_name and family_name claims (through the UI, the resulting manifest looks like this):
"idToken": [
{
"name": "family_name",
"source": "user",
"essential": false,
"additionalProperties": []
},
{
"name": "given_name",
"source": "user",
"essential": false,
"additionalProperties": []
}
],
During the redirect I add the profile scope along with the given_name and family_name scopes, which results in the following error.
Message contains error: 'invalid_client', error_description: 'AADSTS650053: The application 'REDACTED' asked for scope 'given_name' that doesn't exist on the resource '00000003-0000-0000-c000-000000000000'. Contact the app vendor.
Any ideas? As I understand that is what is required to configure these optional claims on the v2.0 endpoint as described here: https://learn.microsoft.com/en-us/azure/active-directory/develop/active-directory-optional-claims#v20-specific-optional-claims-set
You should only use the profile 'scope', which should result in you receiving the given_name and family_name 'claims'. That's standard behaviour for an Authorization Server, which will then either:
Return the name details directly in the id token
Or allow you to send an access token to the user info endpoint to get the name details
However, Azure v2 is very Microsoft specific, and user info lookup can be painful and involve sending a separate type of token to the Graph user info endpoint. Hopefully you won't have to deal with that and you will get the name details directly in the id token.
I had a scenario where my API (which only received an access token) needed to get user info, and I solved it via steps 14 - 18 of this write up, but it's a convoluted solution.
Once you configure optional claims for your application through the UI or application manifest. you need to provide profile Delegated permissions for the application.

Making a simple authorized request to eBay

I'm planning to integrate a website with eBay using PHP, but first I'm using Postman to test everything.
Authorization took me an entire day, but I think I've got it working now. (I had to update to the latest version of Postman, then I got it to create a token for me.)
I say I think because I haven't managed to get a single request to work. I deliberately chose bulkGetInventoryItem (documentation) as it seemed like one of the easier authorized requests to get working. I just know that when the authentication settings are wrong, I get a different error message to when they are right.
For troubleshooting reasons, I made a token with all the scopes:
https://api.ebay.com/oauth/api_scope
https://api.ebay.com/oauth/api_scope/sell.marketing
https://api.ebay.com/oauth/api_scope/sell.inventory
https://api.ebay.com/oauth/api_scope/sell.account
https://api.ebay.com/oauth/api_scope/sell.fulfillment
https://api.ebay.com/oauth/api_scope/sell.finances
https://api.ebay.com/oauth/api_scope/sell.payment.dispute
https://api.ebay.com/oauth/api_scope/commerce.identity.readonly
(added as space-separated list of links)
I have changed one of the eBay listings to have an SKU of "123456" just for this test, however the error I get is exactly the same as if I change "sku": "123456" to "sku": "anObviouslyFakeSKU", but anything else I change creates a new error, so I'm suspecting the issue to be SKU related, but maybe it isn't. (I've found the eBay API to be very poor at sending relevant error messages.)
I'm quite new to Postman, so it's likely a rookie mistake.
Earlier errors have shown to be minor punctuation issues or wrong radio buttons ticked, so hopefully whatever the error is this time, it should appear in this screenshot.
What did I do wrong this time? (Let me know if there are any other screenshots I can send that might help.)
To help, both with the post's SEO, and ease of copy/pasting, I am transcribing the important text in the screenshot above:
url
POST https://api.ebay.com/sell/inventory/v1/bulk_get_inventory_item
body, raw
{
"requests": [
{
"sku": "123456"
}
]
}
output
{
"errors": [
{
"errorId": 2003,
"domain": "ACCESS",
"category": "APPLICATION",
"message": "Internal error",
"longMessage": "There was a problem with an eBay internal system or process. Contact eBay developer support for assistance",
"parameters": [
{
"name": "reason",
"value": "Failed to transform underlying error response, see logs."
}
]
}
]
}
Update:
One more screenshot
Update 2:
Another screenshot
A few things you need to check for in Postman.
When you authenticate and receive a token are you posting that token with your api calls like this one POST https://api.ebay.com/sell/inventory/v1/bulk_get_inventory_item?
Have you set the Authorization HTTP header for authentication authorization?
Have you set the Content-Type header for the call to application/json?
More info here: https://developer.ebay.com/api-docs/sell/inventory/resources/inventory_item/methods/bulkGetInventoryItem
Update
Authorization with environment variable in Postman:
Postman environment variables documentation:
https://learning.postman.com/docs/postman/variables-and-environments/variables/
I figured out the issue. My biggest mistake was choosing bulkGetInventoryItem as the "simplest" call. I should have chosen getInventoryItem, as the error reporting on that function is far more user friendly.
So the error I got, for exactly the same request was "We didn't find the entity you are requesting. Please verify the request"
A quick google of the error found me this page https://forums.developer.ebay.com/questions/17883/cannot-get-my-listed-product-by-get-inventory-api.html which led me to the correct answer!
The inventory item I was trying to access was unreachable because it was not created through the developer API.
I hope this answer helps others, as it wasted a full day of my life trying getInventoryItem before tackling bulkGetInventoryItem.

Microsoft Graph - Retrieving invalid contact email address

If an Office 365 contact's email address is invalid (ex: user#example?com), how do I retrieve the the email address with Microsoft Graph?
I've tried /contacts and /contacts/{id}. The first returns an empty address:
"emailAddresses": [
{
"name": "name",
"address": ""
}
]
and the second simply omits it:
"emailAddresses": [
{
"name": "name"
}
]
Edit: By "contact" I mean Outlook contacts accessible in the Office 365 People app, not regular Office 365 users. Sorry if my question was unclear.
I'm not sure if this would work, but perhaps give it a try.
string email = await graphClient.Users[your_users_id].Request().Select("Mail").GetAsync().Mail;
To get the answer above, I used this Get User documentation which briefly talks about Select statements. And this documentation has a list of the properties which are available to the Select statement.
Found an issue on Github that solved my problem.
Turns out an Exchange contact's (first) EmailAddress has an hidden PidLidEmail1OriginalDisplayName in addition to its address.
When you set the email address to an invalid one, the invalid address is stored in the OriginalDisplayName and its address is cleared, which is the reason the contact's email address is (Empty) in Office 365 People's contact list but the invalid address seems to still be there when you edit the contact.
PidLidEmail1OriginalDisplayName is an MAPI property. In order to obtain it, we need to use extended properties. The request should look like below but with the spaces URL-encoded to %20:
GET /me/contacts/{id}?$expand=singleValueExtendedProperties($filter=id eq 'String {00062004-0000-0000-C000-000000000046} Id 0x8084')
The response should include an additional field containing the invalid address:
"singleValueExtendedProperties": [
{
"id": "String {00062004-0000-0000-c000-000000000046} Id 0x8084",
"value": "user#example?com"
}
If the contact has multiple email addresses, use PidLidEmail2OriginalDisplayName/PidLidEmail3OriginalDisplayName for the contact's second or third email address.

How to add bulk email ID's using surveymonkey api v3

In case of surveymonkey api's of version v2, 'https://api.surveymonkey.net/v2/batch/send_flow' with the body containing recepients list in an array will add all the recipients emailID's to the message simply.
But in case of version v3, is there a simple method to add all the recipients on a bulk and send the emails for all those recipients? The below flow to send the message will add only one recipients emailID or else we have to do several POST calls of "POST /collectors/{id}/messages/{id}/recipients" eachtime with a new emailID. How can we add all the emailID's into the recepients list with one api call and send message to that recipients list?
POST /surveys/{id}/collectors -> POST /collectors/{id}/messages -> POST /collectors/{id}/messages/{id}/recipients -> POST /collectors/{id}/messages/{id}/send
The only way to do it is the way you suggested in V3 right now. The only thing I will add is that there is a bulk recipient endpoint.
So you would
POST /surveys/{id}/collectors
POST /collectors/{id}/messages
POST /collectors/{id}/messages/{id}/recipients/bulk
POST /collectors/{id}/messages/{id}/send
Part of the reason for preferring to split these up is for better transaction management. For example if you call send_flow and you create a collector and a message, then error trying to add recipients for whatever reason, you'll be left with lingering collector/messages. This way you can handle what happens on each error case yourself.
SurveyMonkey is considering releasing some SDKs that have functionality like that encapsulated, as well as potentially a batch request endpoint, but as of right now that is the process for sending a message in the API.
Example use of bulk recipient endpoint:
You can add a list of contacts to your message all at once like this:
POST /collectors/{id}/messages/{id}/recipients/bulk
{
"contact_ids": ["1000", "10001"]
}
You can add all contacts from a list of Contact Lists all at once like this:
POST /collectors/{id}/messages/{id}/recipients/bulk
{
"contact_list_ids": ["2000", "20001"]
}
Or you can manually add any number of contacts by email like this:
POST /collectors/{id}/messages/{id}/recipients/bulk
{
"contacts": [{
"email": "user1#example.com",
"first_name": "User 1",
"last_name": "Testing"
},{
"email": "user2#example.com",
"first_name": "User 2",
"last_name": "Testing"
}]
}
I believe you can add from all three of those methods from one request.

Check if twitter account has been deactivated?

I'm using the twitter4j API and I want to see if, given the ID of a user's account, if that account has been deactivated.
You need to use users/show. It will give you an error code if the user has been suspended.
For example
https://api.twitter.com/1.1/users/show.json?screen_name=nero
Returns
{
"errors": [
{
"code": 63,
"message": "User has been suspended."
}
]
}
If you only have the ID, you can make a similar call - https://api.twitter.com/1.1/users/show.json?user_id=.....
With Twitter4J you use showUser and pass it either the string of the username, or the int of the user ID.
As far as I know there is no dedicated method to do this but using users/lookup (in your case this method) with the user ids you are getting back the the active users only. So if some id is missing from the response those users are the suspended ones.

Resources