JIRA trigger a workflow transition via REST - rest

I want to trigger my test issue's current status, for example A to B via Rest call.
I've searched on the web and come across Atlassian Documentation. What it says:
->You must use POST method.
->You must define transition id in rest call body. Like following:
{
"update": {
"comment": [
{
"add": {
"body": "Aok was here"
}
}
]
},
"transitions": {
"id": "471"
}
}
->You must construct an url like: http://test/jira/rest/api/latest/issue/{ISSUE-KEY}/transitions
When i test above with post-man, i get nothing but a white page response body.
What may be wrong here?
Thanks

Anyone who faces this problem, here is the solution:
You need to make http request with Content-Type:application/json in header.

Related

Using Request Body in Azure Data Factory

I have a working GET request in Postman where the body contains the query as seen below
The body is as follows
{
"query": {
"bool": {
"must": [
{
"term": {
"Vrvirksomhed.cvrNummer": "12345678"
}
}
]
}
}
}
Now i'm trying to get the same GET to work in Aure Data Factory but somehow it seems that the syntax needs to be different as it' doesn't use it correctly. Does it need to be wrapped somehow ?
This is because the ADF will ignore the Request body when your Request method is GET. So it can't work.
You can click '{}' button to view the code of Copy activity.
Even if your request body has content, there isn't requestBody property in source.
If you change your request method to POST, it will show.
So you can change your request method to POST to have a try.

Can a Facebook page message a user without the user first sending a message to the page?

I'm wanting to set up an app for a page(or possibly group) where if a user comments on the page then the page will send the user a private message. So far I'm finding this to be impossible, I'm trying to make the following call via postman:
POST https://graph.facebook.com/v3.2/me/messages
{
"recipient": {
"id": "{receipientId}"
},
"message": {
"text": "hello, world!"
}
}
The error message I'm getting back is:
{
"error": {
"message": "(#551) This person isn't available right now.",
"type": "OAuthException",
"code": 551,
"error_subcode": 1545041,
"fbtrace_id": "{fbtrace_id}"
}
}
I've seen this functionality with another app and I can't seem to find the documentation anywhere that allows this type of behavior, any assistance would be greatly appreciated.
Edit: The recipient id is coming from a page scoped user id.
Ok through more reading I was able to find the answer. Private replies are how to do this.
Send a post to this endpoint:
https://graph.facebook.com/v3.2/{CommentId}/private_replies
{
"message": "Hello, world"
}
Documentation: https://developers.facebook.com/docs/graph-api/reference/v3.2/object/private_replies

How can I grab the context variable mid conversation and use it in my swift program?

So I'm writing a chatbot application which requires the intake of parameters and then uses these parameters in post requests sent via a payload.
I'm having problems with grabbing the context value from a context variable within swift and was wondering how I would go about grabbing the value of the context variable and executing an action based on the value of that said context.
An example of this would be the following dialog flow...
Me: Trigger this
Bot: Ok, give me param x
Me: x
Bot: Ok I have x param, will post job now
This is the kind of flow I want to happen in the background of my application under the hood but I'm not sure how to grab value x after my user has input it.
So, suppose that you are using the iOS SDK from Watson Developer Cloud.
In your Conversation, add in your node:
{
"context": {
"myVariable": "<? input.text ?>"
},
"output": {
"text": {
"values": [
"My context variable value is $myVariable."
],
"selection_policy": "sequential"
}, { "etc": "etc" }
Obs.: The input.text will capture all that user types, you need to use regex for extract exactly what you want, try to see my examples in this answer.
And, in the iOS SDK you can see this follow example:
func testMessage() {
let description1 = "Start a conversation."
let expectation1 = self.expectation(description: description1)
let response1 = ["Hi. It looks like a nice drive today. What would you like me to do?"]
let nodes1 = ["node_1_1467221909631"]
var context: Context?
conversation.message(workspaceID: workspaceID, failure: failWithError) {
response in
// verify input
XCTAssertNil(response.input?.text)
// verify context
XCTAssertNotNil(response.context.conversationID)
XCTAssertNotEqual(response.context.conversationID, "")
XCTAssertNotNil(response.context.system)
XCTAssertNotNil(response.context.system.additionalProperties)
XCTAssertFalse(response.context.system.additionalProperties.isEmpty)
// verify entities
XCTAssertTrue(response.entities.isEmpty)
// verify intents
XCTAssertTrue(response.intents.isEmpty)
// verify output
XCTAssertTrue(response.output.logMessages.isEmpty)
XCTAssertEqual(response.output.text, response1)
XCTAssertEqual(response.output.nodesVisited!, nodes1)
context = response.context
expectation1.fulfill()
}
So, you can access your context variable using:
context.myVariable
response.context.myVariable
See more about methods in Watson Conversation here.
iOS SDK from Watson Developer Cloud.

HttpClient append parameter object to GET request

I'm quite the noob using Ionic or Angular for that matter. So as a cheat sheet I'm using the ionic-super-starter template (link below).
I am trying to make a get request to my API and it works just find if I'm doing it like this:
this.api.get('user/'+this.user.userId+'/entries?include=stuff&access_token=TOKEN');
but when I put the url params into an object it stops working:
let options = {
'include':'stuff',
'access_token':'TOKEN'
}
this.api.get('user/'+this.user.userId+'/entries', options);
The only error I get is "Unauthorized Request" since the options object including the access token was not appended to the url.
In the ionic-super-starter template the providers/api/api.ts calls .set() for each key in my params object:
if (params) {
reqOpts.params = new HttpParams();
for (let k in params) {
reqOpts.params.set(k, params[k]);
}
}
but according to Angular University this is not possible since "HTTPParams is immutable".
If it really was wrong to do this, I don't believe it would be in the ionic template. Nor would I believe that I would be the first person to come across this issue.
However, I am stuck here so any help would be appreciated.
Link to Angular University:
https://blog.angular-university.io/angular-http/#httprequestparameters
Link to ionic-super-starter:
https://github.com/ionic-team/starters/tree/master/ionic-angular/official/super
I think I figured it out myself:
if I write (in my src/providers/api/api.ts)
reqOpts.params = reqOpts.params.append(k, params[k]);
instead of
reqOpts.params.set(k, params[k]);
it works.
if you are using a loopback API as I am you might have nested objects like:
let options = {
"filter": {
"order": "date DESC"
},
"access_token":this.user._accessToken
};
this won’t work. try instead:
let options = {
"filter": '{"order":"date DESC"}',
"access_token":this.user._accessToken
};

Cakephp 2.x get message { "name": "The request has been black-holed", "url": "\/rest_sms_boxs.json" } in Restfull api

I write a controller and it contain multi POST action but whene i post data to these actions my response is :
{ "name": "The request has been black-holed", "url": "/rest_sms_boxs.json" }
Now how can i resolve this problem.
Certainly the security mode.
Try in your controller:
public function beforeFilter()
{
parent::beforeFilter();
$this->Security->unlockedActions = array('your_method');
}