I have probleme with create record in a table, I use the code bellow, but its not working the payload string…..
import requests
url = 'https://app.pipefy.com/graphiql'
payload = "{\"query\":\"{mutation {createTableRecord(input: {table_id: "n1kpekCb", title: "my record", due_date: "2017-12-31T00:00-03:00", fields_attributes: [{field_id: "nombre", field_value: "Tom"}, {field_id: "apellido_paterno", field_value: "tom@trindade.com"}, {field_id: "apellido_materno", field_value: "Trindade"}, {field_id: "n_documento", field_value: "Tom"}, {field_id: "correo_electronico", field_value: "tom@trindade.com"}, {field_id: "telefono_celular", field_value: "tom@trindade.com"}, {field_id: "estado", field_value: "Activo"}, {field_id: "vendedor", field_value: "Sí"}, {field_id: "comprador", field_value: "Sí"}, {field_id: "arrendador", field_value: "Sí"}, {field_id: "arrendatario", field_value: "Sí"}]}) { table_record { id title due_date record_fields { name value } } } }\"}"
headers = { 'authorization': 'Bearer Token', 'content-type': 'application/json' }
print(payload)
response = requests.post(url, data=payload, headers=headers)
print(response)
Best answer by Marcos Carvalho
Hey Gonzalo,
Here are some mutations to update the Table Record information.
mutation {
updateTableRecord(input: {id: 383338802 , title: "teste" }) {
clientMutationId
}
}
If you need to update the Table Record Value , here’s the mutation:
mutation {
updateFieldsValues(input: {nodeId: 383338802 , values: {fieldId: "texto" , value: "Send another value" }}) {
clientMutationId
}
}
And here both examples in Python:
import requests
url = "https://api.pipefy.com/graphql"
payload = {"query" : "mutation { updateTableRecord(input: {id: 383338802, title: \"teste\", statusId:\"late\"}) { clientMutationId } }" }
headers = {
"authorization" : "Bearer YOUR_TOKEN" ,
"content-type" : "application/json"
}
response = requests.request("POST" , url, json=payload, headers=headers)
print(response.text)
import requests
url = "https://api.pipefy.com/graphql"
payload = {"query" : "mutation { updateFieldsValues(input: {nodeId: 383338802, values: {fieldId: \"texto\", value: \"Send another value\"}}) { clientMutationId } }" }
headers = {
"authorization" : "Bearer YOUR_TOKEN" ,
"content-type" : "application/json"
}
response = requests.request("POST" , url, json=payload, headers=headers)
print(response.text)
Hope it helps you
View original