I have following tfstate file (it has JSON structure)
{
"version": 3,
"terraform_version": "0.11.1",
"serial": 1,
"lineage": "4d050905-8f3d-46df-8bbb-8859c708abe7",
"modules": [
{
"path": [
"root"
],
"outputs": {
"id": {
"sensitive": false,
"type": "list",
"value": [
"34.244.138.72",
"34.249.95.222"
]
}
},
"resources": {
"aws_instance.win-example.0": {
"type": "aws_instance",
"depends_on": [
"aws_security_group.DJukes"
],
"primary": {
"id": "i-0f8c0fcb36f58947d",
"attributes": {
"ami": "ami-cc821eb5",
"associate_public_ip_address": "true",
"availability_zone": "eu-west-1a",
"disable_api_termination": "false",
"ebs_block_device.#": "0",
"ebs_optimized": "false",
"ephemeral_block_device.#": "0",
"iam_instance_profile": "",
"id": "i-0f8c0fcb36f58947d",
"instance_state": "running",
"instance_type": "t2.medium",
"ipv6_addresses.#": "0",
"key_name": "",
"monitoring": "false",
"network_interface.#": "0",
"network_interface_id": "eni-8dbf17be",
"placement_group": "",
"primary_network_interface_id": "eni-8dbf17be",
"private_dns": "ip-172-31-30-138.eu-west-1.compute.internal",
"private_ip": "172.31.30.138",
"public_dns": "ec2-34-244-138-72.eu-west-1.compute.amazonaws.com",
"public_ip": "34.244.138.72",
"root_block_device.#": "1",
"root_block_device.0.delete_on_termination": "true",
"root_block_device.0.iops": "100",
"root_block_device.0.volume_id": "vol-0dcfa45e001323eac",
"root_block_device.0.volume_size": "30",
"root_block_device.0.volume_type": "gp2",
"security_groups.#": "1",
"security_groups.4272775738": "DJukes",
"source_dest_check": "true",
"subnet_id": "subnet-5b50a512",
"tags.%": "1",
"tags.Name": "DJukes-1",
"tenancy": "default",
"user_data": "fad67bb12b32d15c3f5156bf7bdd830d4e084c6f",
"volume_tags.%": "0",
"vpc_security_group_ids.#": "1",
"vpc_security_group_ids.2187737336": "sg-fd5adf87"
},
"meta": {
"e2bfb730-ecaa-11e6-8f88-34363bc7c4c0": {
"create": 600000000000,
"delete": 600000000000,
"update": 600000000000
},
"schema_version": "1"
},
"tainted": false
},
"deposed": [],
"provider": "provider.aws"
},
"aws_instance.win-example.1": {
"type": "aws_instance",
"depends_on": [
"aws_security_group.DJukes"
],
"primary": {
"id": "i-0bb714a7ddd376599",
"attributes": {
"ami": "ami-cc821eb5",
"associate_public_ip_address": "true",
"availability_zone": "eu-west-1a",
"disable_api_termination": "false",
"ebs_block_device.#": "0",
"ebs_optimized": "false",
"ephemeral_block_device.#": "0",
"iam_instance_profile": "",
"id": "i-0bb714a7ddd376599",
"instance_state": "running",
"instance_type": "t2.medium",
"ipv6_addresses.#": "0",
"key_name": "",
"monitoring": "false",
"network_interface.#": "0",
"network_interface_id": "eni-dab018e9",
"placement_group": "",
"primary_network_interface_id": "eni-dab018e9",
"private_dns": "ip-172-31-24-177.eu-west-1.compute.internal",
"private_ip": "172.31.24.177",
"public_dns": "ec2-34-249-95-222.eu-west-1.compute.amazonaws.com",
"public_ip": "34.249.95.222",
"root_block_device.#": "1",
"root_block_device.0.delete_on_termination": "true",
"root_block_device.0.iops": "100",
"root_block_device.0.volume_id": "vol-079b3491295b06249",
"root_block_device.0.volume_size": "30",
"root_block_device.0.volume_type": "gp2",
"security_groups.#": "1",
"security_groups.4272775738": "DJukes",
"source_dest_check": "true",
"subnet_id": "subnet-5b50a512",
"tags.%": "1",
"tags.Name": "DJukes-2",
"tenancy": "default",
"user_data": "fad67bb12b32d15c3f5156bf7bdd830d4e084c6f",
"volume_tags.%": "0",
"vpc_security_group_ids.#": "1",
"vpc_security_group_ids.2187737336": "sg-fd5adf87"
},
"meta": {
"e2bfb730-ecaa-11e6-8f88-34363bc7c4c0": {
"create": 600000000000,
"delete": 600000000000,
"update": 600000000000
},
"schema_version": "1"
},
"tainted": false
},
"deposed": [],
"provider": "provider.aws"
},
"aws_security_group.DJukes": {
"type": "aws_security_group",
"depends_on": [],
"primary": {
"id": "sg-fd5adf87",
"attributes": {
"description": "Managed by Terraform",
"egress.#": "1",
"egress.482069346.cidr_blocks.#": "1",
"egress.482069346.cidr_blocks.0": "0.0.0.0/0",
"egress.482069346.description": "",
"egress.482069346.from_port": "0",
"egress.482069346.ipv6_cidr_blocks.#": "0",
"egress.482069346.prefix_list_ids.#": "0",
"egress.482069346.protocol": "-1",
"egress.482069346.security_groups.#": "0",
"egress.482069346.self": "false",
"egress.482069346.to_port": "0",
"id": "sg-fd5adf87",
"ingress.#": "1",
"ingress.2601213444.cidr_blocks.#": "1",
"ingress.2601213444.cidr_blocks.0": "0.0.0.0/0",
"ingress.2601213444.description": "",
"ingress.2601213444.from_port": "0",
"ingress.2601213444.ipv6_cidr_blocks.#": "0",
"ingress.2601213444.protocol": "tcp",
"ingress.2601213444.security_groups.#": "0",
"ingress.2601213444.self": "false",
"ingress.2601213444.to_port": "6556",
"name": "DJukes",
"owner_id": "520150089049",
"revoke_rules_on_delete": "false",
"tags.%": "1",
"tags.Name": "allow-RDP",
"vpc_id": "vpc-8b23ccec"
},
"meta": {
"schema_version": "1"
},
"tainted": false
},
"deposed": [],
"provider": "provider.aws"
}
},
"depends_on": []
}
]
I want to extract public IP addresses to variables using python
"value": [
"34.244.138.72",
"34.249.95.222"
]
So far, i have following code:
#!/bin/python
import json
import os.path
import shutil
from os import mkdir
from pprint import pprint
from python_terraform import *
json_data=open('./terraform.json')
data = json.load(json_data)
json_data.close()
for i in range (0, len (data['modules'])):
print data['modules']['path']['outputs'][1]
And getting following error:
File "./1.py", line 17, in <module>
for i in range (0, len (data['modules']['path']['outputs'])):
TypeError: list indices must be integers, not str
also tried:
for dat in data:
print dat['outputs']
We can see from your JSON that modules is a list, which maps to an array with numeric indices, not a dictionary. (Though, there seems to be only one item in the list.)
So you need to iterate over it with i.
See what you are actually receiving with something like:
for i in range (0, len (data['modules'])):
pprint(data['modules'][i]['outputs']['id']['value'])
Which outputs:
$ python 1.py
[u'34.244.138.72', u'34.249.95.222']
Related
I am working on OPC DA & AE. For that, I am using the IIOT OPCUA node in Node-red.
With the IIOT OPCUA node in Node-red I am able to connect and access data but for accessing the alarms and events not getting what to do.
I have tested my OPCAE server with the OPC expert tool and it's working fine but I want to execute alarms and events with Node-red.
Please help me out regarding this issue.
Thank you.
I havenĀ“t worked with alarms and events yet but you or other people interessted may have a look on this discusion.
OPCUA-TEST-NODES.json contains an examples for testing events:
[
{
"id": "6413368d70ce7daa",
"type": "tab",
"label": "Test Nodes",
"disabled": false
},
{
"id": "42ce521b1148624d",
"type": "OpcUa-Event",
"z": "6413368d70ce7daa",
"root": "ns=0;i=2253",
"eventtype": "i=2041",
"name": "Events",
"x": 570,
"y": 480,
"wires": [
[
"59e10624d8d6798b",
"7bc93ab21da004f4"
]
]
},
{
"id": "50afc9882c32c9b1",
"type": "inject",
"z": "6413368d70ce7daa",
"name": "Test Events",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": "",
"topic": "",
"payload": "",
"payloadType": "str",
"x": 370,
"y": 480,
"wires": [
[
"42ce521b1148624d"
]
]
},
{
"id": "59e10624d8d6798b",
"type": "OpcUa-Client",
"z": "6413368d70ce7daa",
"endpoint": "bb039652.dcf5a8",
"action": "events",
"deadbandvalue": "",
"time": 10,
"timeUnit": "s",
"localfile": "",
"localkeyfile": "",
"securitymode": "None",
"securitypolicy": "None",
"folderName4PKI": "",
"name": "A & C",
"x": 730,
"y": 480,
"wires": [
[
"47d20f3e7618f5db"
]
]
},
{
"id": "9598544e1e208e0c",
"type": "OpcUa-Client",
"z": "6413368d70ce7daa",
"endpoint": "bb039652.dcf5a8",
"action": "acknowledge",
"deadbandtype": "a",
"deadbandvalue": "5",
"time": "1",
"timeUnit": "s",
"localfile": "",
"localkeyfile": "",
"securitymode": "None",
"securitypolicy": "None",
"name": "ProSys NONE",
"x": 1060,
"y": 580,
"wires": [
[]
]
},
{
"id": "47d20f3e7618f5db",
"type": "debug",
"z": "6413368d70ce7daa",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"x": 890,
"y": 480,
"wires": []
},
{
"id": "9a7458deff86b3b0",
"type": "inject",
"z": "6413368d70ce7daa",
"name": "Test Events",
"repeat": "",
"crontab": "",
"once": false,
"topic": "",
"payload": "",
"payloadType": "str",
"x": 370,
"y": 580,
"wires": [
[
"d02ed4a7087a2cd8"
]
]
},
{
"id": "d02ed4a7087a2cd8",
"type": "function",
"z": "6413368d70ce7daa",
"name": "AlarmID and EventID",
"func": "var msg;\nmsg.topic = \"ns=6;s=MyLevel.Alarm\";\nmsg.conditionId = \"ns=6;s=MyLevel.Alarm/0:EventId\";\nmsg.comment = \"Node-RED OPCUA Ack\";\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 630,
"y": 580,
"wires": [
[
"9598544e1e208e0c"
]
]
},
{
"id": "7bc93ab21da004f4",
"type": "debug",
"z": "6413368d70ce7daa",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"x": 730,
"y": 440,
"wires": []
},
{
"id": "bb039652.dcf5a8",
"type": "OpcUa-Endpoint",
"endpoint": "opc.tcp://H7Q8Q13.vstage.co:53530/OPCUA/SimulationServer",
"secpol": "None",
"secmode": "None",
"login": false
}
]
{
"id": "7bc93ab21da004f4",
"type": "debug",
"z": "6413368d70ce7daa",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"x": 730,
"y": 440,
"wires": []
},
{
"id": "bb039652.dcf5a8",
"type": "OpcUa-Endpoint",
"endpoint": "opc.tcp://H7Q8Q13.vstage.co:53530/OPCUA/SimulationServer",
"secpol": "None",
"secmode": "None",
"login": false
},
{
"id": "85144921.8931b8",
"type": "ui_group",
"name": "OPCUA",
"tab": "440c46c6.769ab8",
"order": 1,
"disp": true,
"width": "6",
"collapse": false
},
{
"id": "440c46c6.769ab8",
"type": "ui_tab",
"name": "Home",
"icon": "dashboard",
"disabled": false,
"hidden": false
}
]
I'm building a monitoring stack for our internal projects. I would like for them to be able to design their own monitoring dashboards to be used inside Grafana so I cannot predict what those will be called.
I created a folder called grafana_dashboard, where I will be instructing them to store their dashboard as JSON files and I want to pass all the contents of that folder to the Grafana instance.
I have tried a number of variations of this :
resource "grafana_dashboard" "dashboards" {
for_each = fileset(path.module, "grafana_dashboard/*.json")
config_json = "${each.key}"
depends_on = [aiven_service.grafana]
}
But keep getting this error:
Error: invalid character 'g' looking for beginning of value
on ../modules/monitoring/grafana.tf line 139, in resource "grafana_dashboard" "dashboards":
139: resource "grafana_dashboard" "dashboards" {
Can any of you see what I'm doing wrong?
Here's an example of one of the .json files i'm trying to pass:
{
"annotations": {
"list": [
{
"builtIn": 1,
"datasource": "-- Grafana --",
"enable": true,
"hide": true,
"iconColor": "rgba(0, 211, 255, 1)",
"name": "Annotations & Alerts",
"type": "dashboard"
},
{
"datasource": "Prometheus",
"enable": true,
"expr": "sum(changes(nginx_ingress_controller_config_last_reload_successful_timestamp_seconds{instance!=\"unknown\",controller_class=~\"$controller_class\",namespace=~\"$namespace\"}[30s])) by (controller_class)",
"hide": false,
"iconColor": "rgba(255, 96, 96, 1)",
"limit": 100,
"name": "Config Reloads",
"showIn": 0,
"step": "30s",
"tagKeys": "controller_class",
"tags": [],
"titleFormat": "Config Reloaded",
"type": "tags"
}
]
},
"description": "Ingress-nginx supports a rich collection of prometheus metrics. If you have prometheus and grafana installed on your cluster then prometheus will already be scraping this data due to the scrape annotation on the deployment.",
"editable": false,
"gnetId": 9614,
"graphTooltip": 0,
"id": 18,
"iteration": 1574177838584,
"links": [],
"panels": [
{
"columns": [
{
"text": "Current",
"value": "current"
}
],
"datasource": "Prometheus",
"fontSize": "100%",
"gridPos": {
"h": 15,
"w": 24,
"x": 0,
"y": 0
},
"height": "1024",
"id": 85,
"links": [],
"options": {},
"pageSize": 15,
"scroll": true,
"showHeader": true,
"sort": {
"col": 1,
"desc": false
},
"styles": [
{
"alias": "Time",
"dateFormat": "YYYY-MM-DD HH:mm:ss",
"pattern": "Time",
"type": "date"
},
{
"alias": "TTL",
"colorMode": "cell",
"colors": [
"rgba(245, 54, 54, 0.9)",
"rgba(237, 129, 40, 0.89)",
"rgba(50, 172, 45, 0.97)"
],
"dateFormat": "YYYY-MM-DD HH:mm:ss",
"decimals": 0,
"pattern": "Current",
"thresholds": [
"0",
"691200"
],
"type": "number",
"unit": "s"
},
{
"alias": "",
"colorMode": null,
"colors": [
"rgba(245, 54, 54, 0.9)",
"rgba(237, 129, 40, 0.89)",
"rgba(50, 172, 45, 0.97)"
],
"decimals": 2,
"pattern": "/.*/",
"thresholds": [],
"type": "number",
"unit": "short"
}
],
"targets": [
{
"expr": "avg(nginx_ingress_controller_ssl_expire_time_seconds{kubernetes_pod_name=~\"$controller\",namespace=~\"$namespace\",ingress=~\"$ingress\"}) by (host) - time()",
"format": "time_series",
"instant": false,
"intervalFactor": 1,
"legendFormat": "{{ host }}",
"metric": "gke_letsencrypt_cert_expiration",
"refId": "A",
"step": 1
}
],
"title": "Ingress Certificate Expiry",
"transform": "timeseries_aggregations",
"type": "table"
}
],
"refresh": "5s",
"schemaVersion": 19,
"style": "dark",
"tags": [
"nginx"
],
"templating": {
"list": [
{
"allValue": ".*",
"current": {
"text": "All",
"value": "$__all"
},
"datasource": "Prometheus",
"definition": "",
"hide": 0,
"includeAll": true,
"label": "Namespace",
"multi": false,
"name": "namespace",
"options": [],
"query": "label_values(nginx_ingress_controller_config_hash, controller_namespace)",
"refresh": 1,
"regex": "",
"skipUrlSync": false,
"sort": 0,
"tagValuesQuery": "",
"tags": [],
"tagsQuery": "",
"type": "query",
"useTags": false
},
{
"allValue": ".*",
"current": {
"text": "All",
"value": "$__all"
},
"datasource": "Prometheus",
"definition": "",
"hide": 0,
"includeAll": true,
"label": "Controller Class",
"multi": false,
"name": "controller_class",
"options": [],
"query": "label_values(nginx_ingress_controller_config_hash{namespace=~\"$namespace\"}, controller_class) ",
"refresh": 1,
"regex": "",
"skipUrlSync": false,
"sort": 0,
"tagValuesQuery": "",
"tags": [],
"tagsQuery": "",
"type": "query",
"useTags": false
},
{
"allValue": ".*",
"current": {
"text": "All",
"value": "$__all"
},
"datasource": "Prometheus",
"definition": "",
"hide": 0,
"includeAll": true,
"label": "Controller",
"multi": false,
"name": "controller",
"options": [],
"query": "label_values(nginx_ingress_controller_config_hash{namespace=~\"$namespace\",controller_class=~\"$controller_class\"}, controller_pod) ",
"refresh": 1,
"regex": "",
"skipUrlSync": false,
"sort": 0,
"tagValuesQuery": "",
"tags": [],
"tagsQuery": "",
"type": "query",
"useTags": false
},
{
"allValue": ".*",
"current": {
"text": "All",
"value": "$__all"
},
"datasource": "Prometheus",
"definition": "",
"hide": 0,
"includeAll": true,
"label": "Ingress",
"multi": false,
"name": "ingress",
"options": [],
"query": "label_values(nginx_ingress_controller_requests{namespace=~\"$namespace\",controller_class=~\"$controller_class\",controller=~\"$controller\"}, ingress) ",
"refresh": 1,
"regex": "",
"skipUrlSync": false,
"sort": 2,
"tagValuesQuery": "",
"tags": [],
"tagsQuery": "",
"type": "query",
"useTags": false
}
]
},
"time": {
"from": "now-5m",
"to": "now"
},
"timepicker": {
"refresh_intervals": [
"5s",
"10s",
"30s",
"2m",
"5m",
"15m",
"30m",
"1h",
"2h",
"1d"
],
"time_options": [
"5m",
"15m",
"1h",
"6h",
"12h",
"24h",
"2d",
"7d",
"30d"
]
},
"timezone": "browser",
"title": "Cert-manager",
"uid": "nginx",
"version": 12
}
This works, so I know that I can do it, but doesn't suit my needs as I'd need to hardcode the name of each file:
resource "grafana_dashboard" "nginx_ingress_controller" {
config_json = templatefile("${path.module}/grafana_dashboard/nginx-ingress-controller.json", { DS_PROMETHEUS = local.prometheus_datasource_name })
depends_on = [aiven_service.grafana]
}
You need to actually use the file contents in your config_json parameter to the grafana_dashboard.
Switching your resource definition to the following should be enough:
resource "grafana_dashboard" "dashboards" {
for_each = fileset(path.module, "grafana_dashboard/*.json")
config_json = file("${path.module}/${each.key}")
depends_on = [aiven_service.grafana]
}
I am using mautic-node npm module for contacting mautic REST API from node.js.My aim is to create a contact from my app in mautic dashboard using mautic REST API,but i am facing issue in creating contact from node.js.Please help me to figure out this.
var mautic = require('mautic-api-node');
var request = require('request');
var config = require('../config/config.js');
var request = require('request');
exports.saveContact = (req, res) => {
queryParameters = JSON.stringify(req.body);
var username = "mauticUsername";
var password = "mauticPassword";
var auth = "Basic " + new Buffer.from(username + ":" +
password).toString("base64");
var options = {
url: 'https://mautic-url/api/contacts/new',
method: "POST",
form: queryParameters,
headers: {
"Authorization": auth
}
};
request(options, (error, response, body) => {
if (error) console.log(error);
console.log("Body", body);
})
}
I am passing this request body to backend:-
{
"firstname":"firstname",
"ipAddress":"Ipaddress",
"lastname":"lastname",
"email":"email"
}
when i run this code i am getting this response
Body {
"contact": {
"isPublished": true,
"dateAdded": "2019-06-08T10:06:25+00:00",
"dateModified": null,
"createdBy": 1,
"createdByUser": "username",
"modifiedBy": null,
"modifiedByUser": null,
"id": 1277,
"points": 0,
"color": null,
"fields": {
"core": {
"title": {
"id": 1,
"group": "core",
"label": "Title",
"alias": "title",
"type": "lookup",
"value": null
},
"firstname": {
"id": 2,
"group": "core",
"label": "First Name",
"alias": "firstname",
"type": "text",
"value": null
},
"lastname": {
"id": 3,
"group": "core",
"label": "Last Name",
"alias": "lastname",
"type": "text",
"value": null
},
"company": {
"id": 4,
"group": "core",
"label": "Primary company",
"alias": "company",
"type": "text",
"value": null
},
"position": {
"id": 5,
"group": "core",
"label": "Position",
"alias": "position",
"type": "text",
"value": null
},
"email": {
"id": 6,
"group": "core",
"label": "Email",
"alias": "email",
"type": "email",
"value": null
},
"mobile": {
"id": 7,
"group": "core",
"label": "Mobile",
"alias": "mobile",
"type": "tel",
"value": null
},
"phone": {
"id": 8,
"group": "core",
"label": "Phone",
"alias": "phone",
"type": "tel",
"value": null
},
"points": {
"id": 9,
"group": "core",
"label": "Points",
"alias": "points",
"type": "number",
"value": null
},
"fax": {
"id": 10,
"group": "core",
"label": "Fax",
"alias": "fax",
"type": "tel",
"value": null
},
"address1": {
"id": 11,
"group": "core",
"label": "Address Line 1",
"alias": "address1",
"type": "text",
"value": null
},
"address2": {
"id": 12,
"group": "core",
"label": "Address Line 2",
"alias": "address2",
"type": "text",
"value": null
},
"city": {
"id": 13,
"group": "core",
"label": "City",
"alias": "city",
"type": "text",
"value": null
},
"state": {
"id": 14,
"group": "core",
"label": "State",
"alias": "state",
"type": "region",
"value": null
},
"zipcode": {
"id": 15,
"group": "core",
"label": "Zip Code",
"alias": "zipcode",
"type": "text",
"value": null
},
"country": {
"id": 16,
"group": "core",
"label": "Country",
"alias": "country",
"type": "country",
"value": null
},
"preferred_locale": {
"id": 17,
"group": "core",
"label": "Preferred Locale",
"alias": "preferred_locale",
"type": "locale",
"value": null
},
"timezone": {
"id": 18,
"group": "core",
"label": "mautic.lead.field.timezone",
"alias": "timezone",
"type": "timezone",
"value": null
},
"last_active": {
"id": 19,
"group": "core",
"label": "Date Last Active",
"alias": "last_active",
"type": "datetime",
"value": null
},
"attribution_date": {
"id": 20,
"group": "core",
"label": "Attribution Date",
"alias": "attribution_date",
"type": "datetime",
"value": null
},
"attribution": {
"id": 21,
"group": "core",
"label": "Attribution",
"alias": "attribution",
"type": "number",
"value": null
},
"website": {
"id": 22,
"group": "core",
"label": "Website",
"alias": "website",
"type": "url",
"value": null
}
},
"social": {
"facebook": {
"id": 23,
"group": "social",
"label": "Facebook",
"alias": "facebook",
"type": "text",
"value": null
},
"foursquare": {
"id": 24,
"group": "social",
"label": "Foursquare",
"alias": "foursquare",
"type": "text",
"value": null
},
"googleplus": {
"id": 25,
"group": "social",
"label": "Google+",
"alias": "googleplus",
"type": "text",
"value": null
},
"instagram": {
"id": 26,
"group": "social",
"label": "Instagram",
"alias": "instagram",
"type": "text",
"value": null
},
"linkedin": {
"id": 27,
"group": "social",
"label": "LinkedIn",
"alias": "linkedin",
"type": "text",
"value": null
},
"skype": {
"id": 28,
"group": "social",
"label": "Skype",
"alias": "skype",
"type": "text",
"value": null
},
"twitter": {
"id": 29,
"group": "social",
"label": "Twitter",
"alias": "twitter",
"type": "text",
"value": null
}
},
"personal": [],
"professional": [],
"all": {
"id": 1277,
"title": null,
"firstname": null,
"lastname": null,
"company": null,
"position": null,
"email": null,
"mobile": null,
"phone": null,
"points": null,
"fax": null,
"address1": null,
"address2": null,
"city": null,
"state": null,
"zipcode": null,
"country": null,
"preferred_locale": null,
"timezone": null,
"last_active": null,
"attribution_date": null,
"attribution": null,
"website": null,
"facebook": null,
"foursquare": null,
"googleplus": null,
"instagram": null,
"linkedin": null,
"skype": null,
"twitter": null
}
},
"lastActive": null,
"owner": null,
"ipAddresses": [],
"tags": [],
"utmtags": null,
"stage": null,
"dateIdentified": null,
"preferredProfileImage": null,
"doNotContact": [],
"frequencyRules": []
}
}
This is the response of GET contacts API i guess so i am confused why i am getting GET API response while doing POST request to contact API please help me to figure out this issue.
As you can see in the picture, when you create a new contact along with response status code it returns the properties as well which are similar to "Get Contact" request(as you will get when you get contact by id). So I think as long as your new contact is being created in mautic you shouldn't be worried.
I tried to use a GET call in POSTMAN to get the List of Templates and include the Custom Field, but the response does not return the custom_fields value, any thoughts?
GET:
https://demo.docusign.net/restapi/v2/accounts/{account_id}/templates?include=recipients,documents,custom_fields
RESPONSE
{
"templateId": "XXXXXXXXXXXXXXXXXXXXX",
"name": "DEMO",
"shared": "true",
"password": "",
"description": "",
"lastModified": "2017-06-20T14:13:57.9270000Z",
"pageCount": 2,
"uri": "xxxxxxxxxxx",
"folderName": "DEMO",
"folderId": "617c1361-8576-4b62-930e-735442256a25",
"folderUri": "xxxxxxxxx",
"owner": {
"userName": "XXXXXXXXXXXXXXX",
"userId": "XXXXXXXXXXXXXXXXXX",
"email": "XXXXXXXXX#XXXX.COM"
},
"documents": [
{
"documentId": "1",
"uri": "xxxxxxxxxxxx",
"name": "DS_DEMO.pdf",
"order": "1",
"pages": "1",
"display": "inline",
"includeInDownload": "true",
"signerMustAcknowledge": "no_interaction",
"templateLocked": "false",
"templateRequired": "false",
"documentGroup": "content"
},
{
"documentId": "54582351",
"uri": "xxxxxxxxxxxx",
"name": "XXXXXXXXXXXXXX.png",
"order": "2",
"pages": "1",
"display": "inline",
"includeInDownload": "true",
"signerMustAcknowledge": "no_interaction",
"templateLocked": "false",
"templateRequired": "false",
"documentGroup": "content"
}
],
"emailSubject": "Please sign this DS Document",
"emailBlurb": "Thank you for reaching and showing us your interest in how DocuSign works. Please, practice here.\n\n",
"signingLocation": "Online",
"authoritativeCopy": "false",
"enforceSignerVisibility": "false",
"enableWetSign": "false",
"allowMarkup": "true",
"allowReassign": "true",
"recipients": {
"signers": [
{
"defaultRecipient": "false",
"signInEachLocation": "false",
"email": "",
"recipientId": "4",
"accessCode": "",
"requireIdLookup": "false",
"routingOrder": "2",
"note": "",
"roleName": "System Analyst",
"status": "created",
"deliveryMethod": "email",
"templateLocked": "false",
"templateRequired": "false",
"inheritEmailNotificationConfiguration": "false",
"documentVisibility": [
{
"documentId": "1",
"visible": "true"
},
{
"documentId": "54582351",
"visible": "true"
}
]
},
{
"defaultRecipient": "false",
"signInEachLocation": "false",
"name": "DS Training",
"email": "",
"signingGroupId": "10749",
"signingGroupName": "DS Training",
"recipientId": "2",
"accessCode": "",
"requireIdLookup": "false",
"routingOrder": "1",
"note": "Please complete it as soon you can",
"roleName": "Sales Analyst",
"status": "created",
"deliveryMethod": "email",
"templateLocked": "false",
"templateRequired": "false",
"inheritEmailNotificationConfiguration": "false",
"documentVisibility": [
{
"documentId": "1",
"visible": "true"
},
{
"documentId": "54582351",
"visible": "true"
}
]
}
],
"agents": [],
"editors": [],
"intermediaries": [],
"carbonCopies": [
{
"email": "",
"recipientId": "3",
"accessCode": "",
"requireIdLookup": "false",
"routingOrder": "3",
"note": "",
"roleName": "Manager",
"status": "created",
"templateLocked": "false",
"templateRequired": "false",
"inheritEmailNotificationConfiguration": "false",
"documentVisibility": [
{
"documentId": "1",
"visible": "true"
},
{
"documentId": "54582351",
"visible": "true"
}
]
}
],
"certifiedDeliveries": [],
"inPersonSigners": [],
"recipientCount": "3"
}
},
Reference:
Templates: list documentation
You're right. It is a bug. Thank you for the report. I've verified it and filed DocuSign internal bug report API-7048.
In the meantime, the work-around is to use Templates: get for each of the templates returned by the Templates: list operation.
I am trying to create 2 custom fields when creating an Envelope from templates using composite templates below is the json.
{
"emailSubject": "This is a new",
"status": "sent",
"compositeTemplates": [
{
"inlinetemplates": [
{
"sequence": "2",
"recipients": {
"signers": [
{
"email": "email#email.com",
"name": "Jimmy Nobody",
"clientuserid": "1",
"recipientid": "1",
"rolename": "signer",
"dfaultrecipient": "true",
"tabs": {
"texttabs": [
{
"name": "Text",
"tabLabel": "name",
"value": "Joe Smith"
},
{
"name": "Text",
"tabLabel": "address",
"value": "987 apple lane"
}
]
}
}
]
}
}
],
"servertemplates": [
{
"sequence": "1",
"templateId": "52be0f34-d8aa-420f-8283-4e9cc2bb499f"
}
]
},
{
"inlinetemplates": [
{
"sequence": "2",
"recipients": {
"signers": [
{
"email": "email#email.com",
"name": "Jimmy Nobody",
"clientuserid": "1",
"recipientid": "1",
"rolename": "signer",
"dfaultrecipient": "true",
"tabs": {
"texttabs": [
{
"name": "Text",
"tabLabel": "name",
"value": "Joe Smith"
},
{
"name": "Text",
"tabLabel": "address",
"value": "987 apple lane"
}
]
}
}
]
}
}
],
"servertemplates": [
{
"sequence": "1",
"templateId": "e00b896b-4ac7-48b1-8280-bfe3830a61f1"
}
]
}
],
"customFields": {
"textCustomFields": [
{
"name": "callingsystem",
"required": "true",
"show": "false",
"value": "3e56cabd-6211-4203-a462-a7ff960a6b9c"
},
{
"name": "callingsystemid",
"required": "true",
"show": "false",
"value": "crm"
}
]
}
}
The problem is that this JSON is accepted and and envelope is created but no custom fields are on the envelope. What am i doing wrong?
You want to put it inside the inline templates tag. Also your formatting was a bit off and you had a typo in defaultRecipient
Try this:
{
"emailSubject": "This is a new",
"status": "sent",
"compositeTemplates": [
{
"serverTemplates": [
{
"sequence": "1",
"templateId": "52be0f34-d8aa-420f-8283-4e9cc2bb499f"
}
]
},
{
"serverTemplates": [
{
"sequence": "1",
"templateId": "e00b896b-4ac7-48b1-8280-bfe3830a61f1"
}
]
},
{
"inlineTemplates": [
{
"sequence": "2",
"customFields": {
"textCustomFields": [
{
"name": "callingsystem",
"required": "true",
"show": "false",
"value": "3e56cabd-6211-4203-a462-a7ff960a6b9c"
},
{
"name": "callingsystemid",
"required": "true",
"show": "false",
"value": "crm"
}
]
},
"recipients": {
"signers": [
{
"email": "email#email.com",
"name": "Jimmy Nobody",
"clientuserid": "1",
"recipientid": "1",
"rolename": "signer",
"defaultrecipient": "true",
"tabs": {
"texttabs": [
{
"name": "Text",
"tabLabel": "name",
"value": "Joe Smith"
},
{
"name": "Text",
"tabLabel": "address",
"value": "987 apple lane"
}
]
}
}
]
}
}
]
}
]
}