Sending Json to Jira Api - php

I am trying to send a POST request to Jira API
Example Json
{
"fields": {
"project":
{
"key": "BAR"
},
"summary": "testttt",
"description": "Creating of an issue using project keys and issue type names using the REST API",
"issuetype": {
"name": "Bug"
},
"priority" :{
"name" : "Low"
}
}
}
I am successfully making a POST request with postman to the API but I am struggling to make this POST request with Laravel.
I made a form in HTML where the admin must write some data like summary description issuetype and priority. I am accepting the data in the back end but I am having trouble how can I build such JSON with Laravel.
As you can see here
"issuetype": {
"name": "Bug"
}
name is nested in the issutype how can I explicitly create it to be ready to send into the API

Related

Can't update SendGrid Single Send associated lists using the API

I'm using the latest SendGrid PHP API. I can successfully create a Single Send using the API, and easily associate lists the Single Send should go to when it's eventually scheduled (by list ID). When I use the API to then update that Single Send to use different lists, the list changes are not reflected in the SendGrid dashboard - only name changes, etc. The API request is successful in code and when using Postman. SendGrid's API response to the update reflects my changes in what they return back to me. The Single Send is also in "draft mode" when I attempt this. The associated lists in the SendGrid dashboard never change.
API call to Single Send Update Endpoint (PATCH):
https://api.sendgrid.com/v3/marketing/singlesends/3ee0cd4e-62f7-21eb-8ee8-3a2e1ebc21ed
with param:
{
"name": "TESTER 2",
"send_to": {
"list_ids": [
"52ca8ad3f-9db1-4c2x-1f01-85beecbx94c2"
]
}
}
And SendGrid returns (202, successful response code):
{
"id": "3ee0cd4e-62f7-21eb-8ee8-3a2e1ebc21ed",
"name": "TESTER 2",
"status": "draft",
"categories": [],
"send_at": "2021-02-01T19:06:00Z",
"send_to": {
"list_ids": [
"52ca8ad3f-9db1-4c2x-1f01-85beecbx94c2"
],
"segment_ids": [],
"all": false
},
"updated_at": "2021-01-31T22:52:58Z",
"created_at": "2021-01-31T19:07:20Z",
"email_config": {
"subject": "Hello World",
"html_content": "Hello World!",
"plain_content": "Hello World!",
"generate_plain_content": false,
"editor": "code",
"suppression_group_id": null,
"custom_unsubscribe_url": "https://www.example.org/unsubscribe",
"sender_id": 1212111,
"ip_pool": null
}
}
But, the associated contact lists are not updated. Anyone have any suggestions? My only workaround is to simply delete the single send every time and just re-create it. I'm storing their ID's locally so this adds a bit more work on my end, but I'm not sure what else to do.
To anyone struggling with this, hopefully this will save you some time. The problem wasn't with the API at all, but with the SendGrid dashboard. You need to do a hard reload on the Single Send dashboard page to see your changes. The SendGrid dashboard is a SPA. Ugh.

Facebook API Webhook - Get Post ID

Can I get a specific post ID from a Webhook, currently I can make an API call and get all the data I need and store it locally to display to the user, however if I decide to use Webhbook to get new updates all they give me is a UID and ID which are both the same.
Is there any way to retrieve the specific post/notification ID through Webhook? Or does it only really tell you that you its time to make another API call and update/compare your records?
Here is an example of what I am returned -
{
"object": "user",
"entry": [
{
"uid": "123456789",
"id": "123456789",
"time": 1374846331,
"changed_fields": [
"feed"
]
}
]
}
Thanks.

Can i use the facebook api to get details about who posted on my facebook page?

As the title mentions, i wish to make a feed on a website, with the message a user posted on my facebook page and also his name and profile picture.
I managed to get the messages from my fb page but that's about all
{
"data": [
{
"message": "message",
"created_time": "time",
"id": "id"
},
{
"message": "message",
"created_time": "time",
"id": "id"
}
]
}
I have been struggling with this for some time now, is it even possible ?
You should declare the fields you want (see the doc), in your case, the from field (see post node reference).

PHP activity feed - similar to Facebook - How to convert response from json to HTML elements

We are building a activity stream kind of website very similar to facebook (in activity feed alone). For loading user's activity feed, we send the request to PHP file through AJAX method. Server file will handle the logic and return back the values as an array in JSON format. I wanted to know, is there any framework available to write the JSON response to HTML elements. Also, the fees are not similar. It will vary according to the type (Photo, Album, Status Updated, Shared, Liked, etc). So i need to load different template view for each of the activity feed. Actions will be common like Share, Comments for all feeds.
Can you please share which will be the best approach to load the content according to the data received. Also the content need to be refreshed periodically. I have pasted the sample JSON response below for reference:
{
"id": "1",
"picture": "",
"link": "http://www.google.com",
"name": "Srini updated status",
"description": "Lorem ipsum",
"actions": [
{
"name": "Share",
"link": "http://networkedblogs.com/hGWk3?a=share"
}
],
"type": "statusupdate",
"created_time": "2011-05-10T18:35:38+0000",
"updated_time": "2012-07-20T10:42:58+0000",
"likes": {
"count": 0
},
"comments": {
"data": [
{
"id": "19292868552_10150189643478553_22286888",
"from": {
"name": "Lorenzo Portillo",
"id": "613727863"
},
"message": "does anyone knows why i get a rhombus and '?' in my app description when I publish in a user's wall, instead of a letter with accent?!?!?!?!?!?",
"created_time": "2012-05-28T13:48:45+0000"
},
"count": 1
}
}
Need help / suggestions on how to design the template according to the json array in javascript. Any comments / code help will be more helpful.
Thanks in Advance,
Regards
Srinivasan.C
Well, if you consider making a very robust app, take a good look at emberjs.
You should also try jquery's (jquery mobile, jquery ui, jquery ajax)
You can create an html output in your php file when you are getting the response from the Facebook API. According to me you can do json operation easily in PHP. By using json_decode you get array and that you can traverse it and build an html as per your requirement.
Hope it helps

get the user who sent application request

Scenario:
User A send application request to user B
User B accepts request
after accepting request, I want User A's facebook ID who actually sent request
In short I want inviting user on application request accept event of invitee user.
You can get the details on request (including creator details) by querying Graph API with ID of request (you have list of accepting request ids in request_ids parameter passed to you app canvas):
https://graph.facebook.com/REQUEST_ID
This will return details in following format (as described in requests documentation, see "Accepting an App Request / Request ID Format"):
{
"id": "REQUEST_OBJECT_ID",
"application": {
"name": "APP_DISPLAY_NAME",
"canvas_name": "APP_NAME", // This is identical to the app namespace
"namespace": "APP_NAMESPACE",
"id": "APP_ID"
},
"from": {
"name": "SENDER_USER_NAME",
"id": "SEND_USER_ID"
},
"message": "Check out this Awesome Request!",
"created_time": "2012-01-24T00:43:22+0000",
"type": "apprequest"
}

Categories