Podio API - GET form - ruby-on-rails

Looking for some help from an experienced Podio API navigator!
I'm trying to build a feature into our rails app where I can pull the details of a form from Podio, so that I can then automatically generate a form in our environemnt that can post to the app.
To do that I would need to get the category and labels of the fields..
However, when you GET a form from podio, this is all it gives you for the fields:
"fields": [
{
"field_id": foo,
"settings": null
},
{
"field_id": foo,
"settings": null
}
any thoughts on how I might use this information to get the information that I need? Can I somehow use the field_id to GET the field?

You can get the app and the fields within it by using GET request to,
/app/{app_id}/field/{field_or_external_id}

Related

Add a tag to an existing contact using the Mautic API

I've been driving myself crazy for days trying to figure it out.
When I search "tags" in the docs, the only results seem to relate to creating and editing the tag records themselves rather than any association to a contact's record.
I see this test class linked from this issue but don't understand since there isn't actual documentation or a simple example of how to use the API to add a tag to a contact.
I'd appreciate any help. Thanks.
'tags' => ['tag1', 'tag2']
P.S. That test class code seems to be for creating a new contact with certain tags, when instead what I want to do is associate an existing tag with an existing contact.
It's the same payload for create and update as well.
Endpoint: PATCH api/contacts/ID/edit
With data: tags[0]=tagA
which will URL decode to: tags%5B0%5D=tagA
Or you can use JSON format for the data payload if you specify it in the header ('Content-Type: application/json'):
{
"tags": ["tagA"]
}
The request is containing the tag like this:
{
"contact": {
...
"tags": [
{
"id": 32,
"tag": "tagA"
}
],
...
}

Strapi routes return 404 Not found

I have a problem where all routes in my API return 404 Not found. I followed the Pull from Docker Hub section at strapi/strapi-docker.
What I did, apart from running the images, was creating a new Content type called post containing three fields. If I try GET /post (to get all posts added) I get unauthorized response error. This is expected at this stage. After I check Roles & Permissions to allow the Public role to use the find and findOne routes I instead get a 404 Not found response error even though data has been added.
The dev server does not use any prefix.
post routes for find and findOne looks as the following:
{
"routes": [
{
"method": "GET",
"path": "/post",
"handler": "Post.find",
"config": {
"policies": []
}
},
{
"method": "GET",
"path": "/post/:_id",
"handler": "Post.findOne",
"config": {
"policies": []
}
}
}
There are not many options in the strapi interface to fiddle with so I'm not sure what else to try. I have tried a couple of other installations of strapi. Not sure if that could have messed it up but I vaguely remember trying out strapi/strapi-docker before and getting it to work.
I have stumbled upon this issue many times, and the easiest answer usually is:
Have you published any of your posts?
Strapi has a publishing subsystem which is usually turned on upon the creation of any collection, single type or component.
So when you create any content of any created type, the data is saved as draft and is not publicly available.
Here is my link collection type. It is saved, but not published.
So if you are trying to test an endpoint, but you only have one single data entry and it is set to draft, no data will show up.
No data!
In case of a single type that is not published
This will return a 404!
Publish and, voila ...
This could be one reason why strapi is sending you a 404 or only an empty array!
I've had this issue many times as well, even with published content.
Two additional causes could be:
if your content type is posts try /posts as well as /api/posts (the 2nd usually works for me
Under Settings > Roles (the one under USERS & PERMISSIONS plugins) make sure both Authenticated and Public user roles have find and findOne access to the content type.
One time I was getting the 404 even though I did this for Public...but because I was in the same browser as my logged in admin and needed to update it for Authenticated as well.

How to add a flag to jira issue via rest api

I would like to be able to add a flag to an issue via the Jira API. I was unable to find any documentation regarding this issue. Does anyone know how this works?
I've figured out how to do this, I'm not sure on the version of the API. I made a POST request to:
yourdomain /rest/greenhopper/1.0/xboard/issue/flag/flag.json
And in the body (replace JIRA-ISSUE with your issue key):
{"issueKeys":["JIRA-ISSUE"],"flag":true}
I hope this helps.
Here is the best answer I found.
https://answers.atlassian.com/questions/38062844/answers/38062897
There is a field called Flagged. It is a checkbox type field. There is a single value by default, Impediment. The field is checked for null status. If the field is null, the issue is not flagged. If the field is not null, the issue is flagged.
You would use the REST API for this. Examples are here –
https://developer.atlassian.com/jiradev/jira-apis/jira-rest-apis/jira-rest-api-tutorials/jira-rest-api-example-create-issue.
You'll either need to know the field ID (customfield_10000) or you need to to script the discovery of the field by searching the metadata – https://developer.atlassian.com/jiradev/jira-apis/jira-rest-apis/jira-rest-api-tutorials/jira-rest-api-example-discovering-meta-data-for-creating-issues.
An example of setting a custom field while creating the issue over API –
curl -D- -u fred:fred -X POST --data {"fields":{"project":{"key": "TEST"}, "summary": "Always do right. This will gratify some people and astonish the REST.", "description": "Creating an issue while setting custom field values", "issuetype":{"name": "Bug"}, "customfield_10000": [{"value": "Impediment"}]}} -H "Content-Type: application/json" http://localhost:8090/rest/api/2/issue/
non-minified data Expand source
{
"fields": {
"project":
{
"key": "TEST"
},
"summary": "Always do right. This will gratify some people and astonish the REST.",
"description": "Creating an issue while setting custom field values",
"issuetype": {
"name": "Bug"
},
"customfield_10000": [ {"value": "Impediment" }]
}
}
As mentioned here, "Flagged" is a checkbox custom field that accepts a single value "Impediment".
You should be able to set it using the JIRA REST API just like any other custom field. Maybe the examples here will help.
You can also set custom field values using the JIRA Java API.
I'm struggling with this right now. It seems that the Flagged field is not a checkbox type field anymore, but multicheckbox. So the data format I need to send to Jira Cloud API to set the flag in my case look like this:
{update:
{customfield_10021:
[{set:
[{id:“10019”}]
}]
}
}
To remove the flag the data I sent to Jira look like this:
{update:
{customfield_10021:
[{set:
[]
}]
}
}
In the above customfield_10021 is Flagged field's key and 10019 is id that sets the flag. Both of them you need to figure out for your Jira Cloud instance for example by aquiring issue with set Flagged field and checking how it is set.
Just to make it clear, to add/remove a flag I use edit issue end point described here.
Also, to be able to add/remove flag the Flagged field has to be on the edit screen of the issue type that you want to modify and your user needs to have proper priviliges.

JIRA API create issue with custom fields

i want to create an issue in JIRA by using the REST API provided by JIRA.
i am able to create a simple issue,
using this :
http://localhost:8080/rest/api/latest/issue
and data as follows:
{"fields":{"project":{"key": "TES"},"summary":"user name not showing validation message","description":"Hi validation is missing from user name","issuetype": {"name": "Bug"},"reporter":{"name":"BruceWayne"} }}
this is running fine.
now i want to add 3 custom fields while creating an issue. The custom fields are Authorname,
AuthorTag,AuthorID. how can i do this in rest api. what should i add in my data.
My sample data is as follows:-
{"fields":{"project":{"key": "TES"},"summary":"my bugs 5","description":"Hi","issuetype": {"name": "Bug"},
"customfield_10000":"roach#yahoo.com",
"customfield_10100":{"value":"abc"},
"reporter":{"name":"amit"},
"components": [{
"add" : {"name" : "abc"}
}],"priority": {
"id": "1"
}
}}
i want to use the names specified for customfields rather than customfield_XXXXX .
One way i think of is to hit the API after creating a simple issue ( using another API hit to get meta data as follows)
http://localhost:8080/rest/api/latest/issue/tes-79?expand=editmeta
and then do json parsing and again issue a put command to update the fields in same issue
but i was looking for a way to do it in single API hit (while creating an issue)
It should be just like setting any other field, but you have to use the field name "customfield_NNNNN" instead
I know that it is very late to answer this question, but then might help others if not the OP at this time of writing.
If you're in doubt about the create, then you could do something like this - Try a GET on an issue that you would rather create manually with the new parameters as well and then based on the output of the same you could then decide to update it with the new parameters with the new name or the old-fashioned customfield_xxx field.
Try a GET like this on cURL
curl -D- -u fred:fred -X GET -H "Content-Type: application/json" https://jira.fred.com/rest/api/2/issue/FRD-88651
Then you could possibly do a POST like how you've done earlier:
http://localhost:8080/rest/api/latest/issue

Access to Facebook users "INTERESTS" lists

I'm creating new iOS app with Facebook API. I need to receive posts from user's "INTERESTS" lists.
But I can't access it. Graph API from path: "my/friendslist" doesn't actually return this list of "INTERESTS".
I'm sure I can access it, cause I can get info from this list by it's ID.
Graph API returns this:
{
"id": "MY_COOL_ID",
"name": "=3",
"list_type": "user_created"
}
But I can't figure out how. Any ideas?
Thanks.

Resources