GraphQL is a query language for your API. It’s a query language for APIs and a runtime for fulfilling those queries with your existing data. GraphQL provides a complete and understandable description of the data in your API.
It gives clients the power to ask for exactly what they need and nothing more, makes it easier to evolve APIs over time, and enables powerful developer tools.
What are Queries and Mutations?
We use queries to fetch data.
We use mutations to add new data or change existing data.
Queries
Example:
query
: operation typesharedBoard
: operation nameboardShareAddress
: In GraphQL, parameters are passed between parentheses (here:(boardShareAddress: "H4kro9A3CnXDztX")
) and inside the query.- In REST, you ask for a complete resource, while in GraphQL, you have to explicitly list the fields you want (
title
,description
, andthemeConfig
in this example). - You can open
https://api.formaloo.net/graphql/
in the browser and in docs, search operation name (sharedBoard
for example), and get detail about fields that you can use in queries.
Request:
Request: <https://api.formaloo.net/graphql/> (POST)
query {
sharedBoard(boardShareAddress: "H4kro9A3CnXDztX") {
title
description
slug
themeConfig
shareAddress
isPrimary
template {
slug
title
}
}
}
Response:
{
"data": {
"sharedBoard": {
"title": "heyyyyyyyy",
"description": "",
"slug": "CQKSy3yb",
"themeConfig": {
"dark_mode": false
},
"shareAddress": "H4kro9A3CnXDztX",
"isPrimary": false,
"template": {
"slug": "hVRmOTD3",
"title": "sprint"
}
}
}
}
Pagination
Example:
https://graphql.org/learn/pagination/#complete-connection-model
first
: the number of items on a page.
after
: cursor of item.
We get a cursor from the last item and use that to paginate.
This query gets 2 items after an item with a cursor YXJyYXljb25uZWN0aW9uOjE
Request: <https://api.formaloo.net/graphql/> (POST)
query {
blocksOfSharedBoard(first:2, after: "YXJyYXljb25uZWN0aW9uOjE", boardShareAddress: "H4kro9A3CnXDztX") {
totalCount
pageInfo {
startCursor
endCursor
hasPreviousPage
hasNextPage
}
edges {
cursor
node{
title
slug
form{
slug
title
}
}
}
}
}
{
"data": {
"blocksOfSharedBoard": {
"totalCount": 4,
"pageInfo": {
"startCursor": "YXJyYXljb25uZWN0aW9uOjI=",
"endCursor": "YXJyYXljb25uZWN0aW9uOjM=",
"hasPreviousPage": false,
"hasNextPage": false
},
"edges": [
{
"cursor": "YXJyYXljb25uZWN0aW9uOjI=",
"node": {
"title": "sprint",
"slug": "5RGyvpR4",
"form": {
"slug": "AB2lqPUi",
"title": "Sprints2"
}
}
},
{
"cursor": "YXJyYXljb25uZWN0aW9uOjM=",
"node": {
"title": "sprint",
"slug": "UfDNhsQL",
"form": {
"slug": "s41NFUFW",
"title": "Sprints2"
}
}
}
]
}
}
}
Mutations
Example:
mutation
: operation typeupdateForm
: operation name- You can open
https://api.formaloo.net/graphql/
in the browser and in docs, search operation name (updateForm
for example), and get detail about fields that you can use in mutations. - We set the fields that want to get the data in response like this:
form {
slug
title
themeConfig
}
Setting the value for Foreign-Key fields:
for setting the value of a foreign key field, we send the slug of the objects in mutation. In this example, we sent the slug of the category.
category: "FJExG9gT"
Setting the value for Many-To-Many fields:
for setting the value of a many-to-many field, we send a list of the slug of the objects in mutation. In this example, we sent a list of slugs for formFields
.
formFields: ["8zD5KEfh", "BknCjiTZ"]
Request:
Request: <https://api.formaloo.net/graphql/> (POST)
mutation{
updateForm(
input: {
slug: "TvM6S0ml",
title: "test",
themeConfig: {color: "blue"},
category: "FJExG9gT",
shuffleChoices: true,
formFields: ["8zD5KEfh", "BknCjiTZ"],
tags: ["O0TmGDGG"],
showTitle: false
}
) {
form {
slug
title
themeConfig
}
}
}
Response:
{
"data":{
"updateForm":{
"form":{
"slug":"TvM6S0ml",
"title":"test",
"themeConfig":{
"color":"blue"
}
}
}
}
}
How to call an API in GraphQL?
Formaloo GraphQL API address:
https://api.formaloo.net/graphql/
Request Headers:
You should set this header in all requests: x-api-key
:
x-api-key: f0a5ce8ecc1fpa87a57f06a52b8e12c48cb16d34
How to get a value of x-api-key
?
Go to the link below and click on Add Source button to create a new connection.
**Formaloo CDP (Beta)**Web site created using create-react-appcdp.formaloo.net
Then click on your connection and you will see this page, you can copy the API Key:


In some cases, you should set the Authorization
header:
Authorization: JWT your-token
How to get a JWT token?
This tutorial helps you get a JWT token.
Querying with GraphQL in Postman
Using Postman’s built-in support for GraphQL
Using JSON in the request body


Send data via raw JSON:
You can send your request via raw JSON body.
Examples:
Update Form
- Endpoint:
https://api.formaloo.net/graphql/
- Method:
POST
- Content-Type:
application/json
Request: <https://api.formaloo.net/graphql/> (POST)
{
"query":"mutation updateForm($input: FormUpdateMutationInput!) {updateForm(input: $input) {form {slug title themeConfig fields}}}",
"operationName":"updateForm",
"variables":{
"input":{
"slug": "TvM6S0ml",
"title": "test",
"themeConfig": {"color": "blue"},
"category": "FJExG9gT",
"shuffleChoices": true,
"formFields": ["8zD5KEfh", "BknCjiTZ"],
"tags": ["O0TmGDGG"],
"showTitle": false
}
}
}
Show Form
- Endpoint:
https://api.formaloo.net/graphql/
- Method:
POST
- Content-Type:
application/json
Request: <https://api.formaloo.net/graphql/> (POST)
{
"query":"query showForm($address: String!) {showForm(address: $address) {slug title totalSize shuffleFields createType formType needsLogin backgroundColor}}",
"variables":{
"address":"0h0qp"
},
"operationName":"showForm"
}
Form Maker GraphQL Requests
- Create Form
- Update Form
- Submit Form
- Copy Form
- Update Row
- Show Form
- Forms Of User
- Get Row
- Get Rows Of Form
- Get Form-Templates
- Get Form-Categories
- Delete Row
- Delete Form
- Delete Form-Category
Create Form
GraphQL API address: https://api.formaloo.net/graphql/
Method: POST
Operation name: createForm
Request body example:
mutation{
createForm(
input: {
title: "new title",
category: "category_slug",
formFields: ["field1slug", "field2slug"],
themeConfig: {color: "blue"},
tags: ["form_tag_slug"],
showTitle: False,
logic: test,
adminEmailNotifTemplate: "email_template_slug",
userEmailNotifTemplate: "email_template_slug",
logoSlug: "test-slug",
backgroundImageSlug: "test-slug2"
}
) {
form {
slug
title
themeConfig
fields
logoUrl
backgroundImageUrl
backgroundImageSlug
}
}
}
Code in python:
import requests
url = "<http://127.0.0.1:8051/graphql/>"
payload="{\\"query\\":\\"mutation{\\\\n createForm(\\\\n input: {\\\\n title: \\\\\\"new title\\\\\\",\\\\n themeConfig: {color: \\\\\\"blue\\\\\\"},\\\\n showTitle: false,\\\\n logic: \\\\\\"test\\\\\\"\\\\n }\\\\n ) {\\\\n form {\\\\n slug\\\\n title\\\\n themeConfig\\\\n fields\\\\n logoUrl\\\\n backgroundImageUrl\\\\n backgroundImageSlug\\\\n }\\\\n }\\\\n}\\\\n\\",\\"variables\\":{}}"
headers = {
'x-api-key': 'c0af8b85020275569c998e932d6a4ebaecd3ef79',
'Content-Type': 'application/json',
'Cookie': 'csrftoken=rCDvasXPtiGe6j33bEmFcQFW4P7qaf2APwJ3Y11nko94Mw6ADxlZeKGXiIH6ek8Y',
'Authorization': 'JWT your-token'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.json())
Update Form
GraphQL API address: https://api.formaloo.net/graphql/
Method: POST
Operation name: updateForm
Request body example:
mutation{
updateForm(
input: {
slug: "TvM6S0ml",
title: "test",
themeConfig: {color: "blue"},
category: "FJExG9gT",
shuffleChoices: true,
formFields: ["8zD5KEfh", "BknCjiTZ"],
tags: ["O0TmGDGG"],
showTitle: false
}
) {
form {
slug
title
themeConfig
customJs
showTitle
fields
}
}
}
Code in python:
import requests
url = "<http://127.0.0.1:8051/graphql/>"
payload="{\\"query\\":\\"mutation{\\\\n updateForm(\\\\n input: {\\\\n slug: \\\\\\"wiArU5fC\\\\\\",\\\\n title: \\\\\\"test\\\\\\",\\\\n themeConfig: {color: \\\\\\"blue\\\\\\"},\\\\n shuffleChoices: true,\\\\n customJs: \\\\\\"test\\\\\\",\\\\n showTitle: false\\\\n }\\\\n ) {\\\\n form {\\\\n slug\\\\n title\\\\n themeConfig\\\\n customJs\\\\n showTitle\\\\n fields\\\\n }\\\\n }\\\\n}\\\\n\\",\\"variables\\":{}}"
headers = {
'x-api-key': 'c0af8b85020275569c998e932d6a4ebaecd3ef79',
'Content-Type': 'application/json',
'Cookie': 'csrftoken=rCDvasXPtiGe6j33bEmFcQFW4P7qaf2APwJ3Y11nko94Mw6ADxlZeKGXiIH6ek8Y',
'Authorization': 'JWT your-token'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.json())
Submit Form
GraphQL API address: https://api.formaloo.net/graphql/
Method: POST
Operation name: submitForm
Request body example:
mutation{
submitForm(
input: {
formSlug: "TvM6S0ml",
submitterRefererAddress: "<https://formaloo.com/>",
submitData: {
field1_slug: "test text",
field2_slug: 22
}
}
) {
row {
slug
data
}
}
}
Code in python:
import requests
url = "<http://127.0.0.1:8051/graphql/>"
payload="{\\"query\\":\\"mutation{\\\\n submitForm(\\\\n input: {\\\\n formSlug: \\\\\\"wiArU5fC\\\\\\",\\\\n submitterRefererAddress: \\\\\\"<https://formaloo.com/\\\\\\>",\\\\n submitData: {\\\\n field1_slug: \\\\\\"test text\\\\\\",\\\\n field2_slug: 22\\\\n }\\\\n }\\\\n ) {\\\\n row {\\\\n slug\\\\n data\\\\n }\\\\n }\\\\n}\\\\n\\",\\"variables\\":{}}"
headers = {
'x-api-key': 'c0af8b85020275569c998e932d6a4ebaecd3ef79',
'Content-Type': 'application/json',
'Cookie': 'csrftoken=rCDvasXPtiGe6j33bEmFcQFW4P7qaf2APwJ3Y11nko94Mw6ADxlZeKGXiIH6ek8Y',
'Authorization': 'JWT your-token'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.json())
Copy Form
GraphQL API address: https://api.formaloo.net/graphql/
Method: POST
Operation name: copyForm
Request body example:
mutation{
copyForm(
input: {
copiedForm: "TvM6S0ml"
}
) {
form {
slug
data
}
}
}
Code in python:
import requests
url = "<http://127.0.0.1:8051/graphql/>"
payload="{\\"query\\":\\"mutation{\\\\n copyForm(\\\\n input: {\\\\n copiedForm: \\\\\\"wiArU5fC\\\\\\"\\\\n }\\\\n ) {\\\\n form {\\\\n slug\\\\n }\\\\n }\\\\n}\\\\n\\",\\"variables\\":{}}"
headers = {
'x-api-key': 'c0af8b85020275569c998e932d6a4ebaecd3ef79',
'Content-Type': 'application/json',
'Cookie': 'csrftoken=rCDvasXPtiGe6j33bEmFcQFW4P7qaf2APwJ3Y11nko94Mw6ADxlZeKGXiIH6ek8Y',
'Authorization': 'JWT your-token'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.json())
Update Row
GraphQL API address: https://api.formaloo.net/graphql/
Method: POST
Operation name: updateRow
Request body example:
mutation{
updateRow(
input: {
formSlug: "TvM6S0ml",
submitterRefererAddress: "<https://formaloo.com/>",
submitData: {
field1_slug: "test text",
field2_slug: 22
},
rowTags: ["row_tag_slug"]
}
) {
row {
slug
data
submitterRefererAddress
nextRow
readableData
}
}
}
Code in python:
import requests
url = "<http://127.0.0.1:8051/graphql/>"
payload="{\\"query\\":\\"mutation{\\\\n updateRow(\\\\n input: {\\\\n slug: \\\\\\"6jkNF3kpTWlDagwFcfHy\\\\\\",\\\\n submitterRefererAddress: \\\\\\"<https://formaloo.com/\\\\\\>"\\\\n }\\\\n ) {\\\\n row {\\\\n slug\\\\n data\\\\n submitterRefererAddress\\\\n nextRow\\\\n readableData\\\\n }\\\\n }\\\\n}\\\\n\\",\\"variables\\":{}}"
headers = {
'x-api-key': 'c0af8b85020275569c998e932d6a4ebaecd3ef79',
'Content-Type': 'application/json',
'Cookie': 'csrftoken=rCDvasXPtiGe6j33bEmFcQFW4P7qaf2APwJ3Y11nko94Mw6ADxlZeKGXiIH6ek8Y',
'Authorization': 'JWT your-token'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.json())
Show Form
GraphQL API address: https://api.formaloo.net/graphql/
Method: POST
Operation name: showForm
Request body example:
query {
showForm(address: "twzb9") {
slug
title
totalSize
shuffleFields
createType
formType
needsLogin
backgroundColor
recaptchaCode
hasWatermark
subdomain
logic
logicMetadata
visitCount
ownerCustomDomain
currency{
title
}
publicRows
formType
fieldsList
fields
}
}
Code in python:
import requests
url = "<http://127.0.0.1:8051/graphql/>"
payload="{\\"query\\":\\"query {\\\\n showForm(address: \\\\\\"44oj4\\\\\\") {\\\\n slug\\\\n title\\\\n totalSize\\\\n shuffleFields\\\\n createType\\\\n formType\\\\n needsLogin\\\\n backgroundColor\\\\n recaptchaCode\\\\n hasWatermark\\\\n subdomain\\\\n logic\\\\n logicMetadata\\\\n visitCount\\\\n ownerCustomDomain\\\\n currency{\\\\n title\\\\n }\\\\n publicRows\\\\n formType\\\\n fieldsList\\\\n fields\\\\n }\\\\n}\\",\\"variables\\":{}}"
headers = {
'x-api-key': 'c0af8b85020275569c998e932d6a4ebaecd3ef79',
'Content-Type': 'application/json',
'Cookie': 'csrftoken=rCDvasXPtiGe6j33bEmFcQFW4P7qaf2APwJ3Y11nko94Mw6ADxlZeKGXiIH6ek8Y',
'Authorization': 'JWT your-token'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.json())
Forms Of User
GraphQL API address: https://api.formaloo.net/graphql/
Method: POST
Operation name: getForms
Request body example:
query {
getForms(first:8, after: "") {
totalCount
pageInfo {
startCursor
endCursor
hasPreviousPage
hasNextPage
}
edges {
cursor
node{
slug
title
totalSize
shuffleFields
createType
formType
needsLogin
backgroundColor
recaptchaCode
hasWatermark
subdomain
}
}
}
}
Code in python:
import requests
url = "<http://127.0.0.1:8051/graphql/>"
payload="{\\"query\\":\\"query {\\\\n getForms(first:8, after: \\\\\\"\\\\\\") {\\\\n totalCount\\\\n pageInfo {\\\\n startCursor\\\\n endCursor\\\\n hasPreviousPage\\\\n hasNextPage\\\\n }\\\\n edges {\\\\n cursor\\\\n node{\\\\n slug\\\\n title\\\\n totalSize\\\\n shuffleFields\\\\n createType\\\\n formType\\\\n needsLogin\\\\n backgroundColor\\\\n recaptchaCode\\\\n hasWatermark\\\\n subdomain\\\\n }\\\\n }\\\\n }\\\\n}\\",\\"variables\\":{}}"
headers = {
'x-api-key': 'c0af8b85020275569c998e932d6a4ebaecd3ef79',
'Content-Type': 'application/json',
'Cookie': 'csrftoken=rCDvasXPtiGe6j33bEmFcQFW4P7qaf2APwJ3Y11nko94Mw6ADxlZeKGXiIH6ek8Y',
'Authorization': 'JWT your-token'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.json())
Get Row
GraphQL API address: https://api.formaloo.net/graphql/
Method: POST
Operation name: getRow
Request body example:
query {
getRow(slug: "Iv1icR3u0GLhh4lYaZr2") {
slug
createType
createdAt
emailVerificationState
status
nextRow
previousRow
submitterRefererAddress
submitCode
readableData
data
renderedData
user{
id
}
rowTags{
slug
}
form{
slug
}
}
}
Code in python:
import requests
url = "<http://127.0.0.1:8051/graphql/>"
payload="{\\"query\\":\\"query {\\\\n getRow(slug: \\\\\\"Iv1icR3u0GLhh4lYaZr2\\\\\\") {\\\\n slug\\\\n createType\\\\n createdAt\\\\n emailVerificationState\\\\n status\\\\n nextRow\\\\n previousRow\\\\n submitterRefererAddress\\\\n submitCode\\\\n readableData\\\\n data\\\\n renderedData\\\\n user{\\\\n id\\\\n }\\\\n rowTags{\\\\n slug\\\\n }\\\\n form{\\\\n slug\\\\n }\\\\n }\\\\n}\\",\\"variables\\":{}}"headers = {
headers = {
'x-api-key': 'c0af8b85020275569c998e932d6a4ebaecd3ef79',
'Content-Type': 'application/json',
'Cookie': 'csrftoken=rCDvasXPtiGe6j33bEmFcQFW4P7qaf2APwJ3Y11nko94Mw6ADxlZeKGXiIH6ek8Y',
'Authorization': 'JWT your-token'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.json())
Get Rows Of Form
GraphQL API address: https://api.formaloo.net/graphql/
Method: POST
Operation name: rowsOfForm
Request body example:
query {
rowsOfForm(first:4, after: "YXJyYXljb25uZWN0aW9uOjM=", formSlug: "Q1shuakG") {
totalCount
pageInfo {
startCursor
endCursor
hasPreviousPage
hasNextPage
}
edges {
cursor
node{
slug
data
form{
slug
title
}
}
}
}
}
Code in python:
import requests
url = "<http://127.0.0.1:8051/graphql/>"
payload="{\\"query\\":\\"query {\\\\n rowsOfForm(first:4, after: \\\\\\"YXJyYXljb25uZWN0aW9uOjM=\\\\\\", formSlug: \\\\\\"wiArU5fC\\\\\\") {\\\\n totalCount\\\\n pageInfo {\\\\n startCursor\\\\n endCursor\\\\n hasPreviousPage\\\\n hasNextPage\\\\n }\\\\n edges {\\\\n cursor\\\\n node{\\\\n slug\\\\n data\\\\n form{\\\\n slug\\\\n title\\\\n }\\\\n }\\\\n }\\\\n }\\\\n}\\",\\"variables\\":{}}"headers = {
headers = {
'x-api-key': 'c0af8b85020275569c998e932d6a4ebaecd3ef79',
'Content-Type': 'application/json',
'Cookie': 'csrftoken=rCDvasXPtiGe6j33bEmFcQFW4P7qaf2APwJ3Y11nko94Mw6ADxlZeKGXiIH6ek8Y',
'Authorization': 'JWT your-token'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.json())
Get Form-Templates
GraphQL API address: https://api.formaloo.net/graphql/
Method: POST
Operation name: getFormTemplates
Request body example:
query {
getFormTemplates(first:1, after: "") {
totalCount
pageInfo {
startCursor
endCursor
hasPreviousPage
hasNextPage
}
edges {
cursor
node{
slug
copiesCount
title
totalSize
shuffleFields
createType
formType
needsLogin
backgroundColor
recaptchaCode
hasWatermark
subdomain
}
}
}
}
Code in python:
import requests
url = "<http://127.0.0.1:8051/graphql/>"
payload="{\\"query\\":\\"query {\\\\n getFormTemplates(first:8, after: \\\\\\"\\\\\\") {\\\\n totalCount\\\\n pageInfo {\\\\n startCursor\\\\n endCursor\\\\n hasPreviousPage\\\\n hasNextPage\\\\n }\\\\n edges {\\\\n cursor\\\\n node{\\\\n slug\\\\n copiesCount\\\\n title\\\\n totalSize\\\\n shuffleFields\\\\n createType\\\\n formType\\\\n needsLogin\\\\n backgroundColor\\\\n recaptchaCode\\\\n hasWatermark\\\\n subdomain\\\\n }\\\\n }\\\\n }\\\\n}\\",\\"variables\\":{}}"headers = {
headers = {
'x-api-key': 'c0af8b85020275569c998e932d6a4ebaecd3ef79',
'Content-Type': 'application/json',
'Cookie': 'csrftoken=rCDvasXPtiGe6j33bEmFcQFW4P7qaf2APwJ3Y11nko94Mw6ADxlZeKGXiIH6ek8Y',
'Authorization': 'JWT your-token'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.json())
Get Form-Categories
GraphQL API address: https://api.formaloo.net/graphql/
Method: POST
Operation name: getFormCategories
Request body example:
query {
getFormCategories(first:1, after: "") {
totalCount
pageInfo {
startCursor
endCursor
hasPreviousPage
hasNextPage
}
edges {
cursor
node{
slug
title
sharedAccess
parentCategory{
slug
title
}
subcategories{
slug
}
}
}
}
}
Code in python:
import requests
url = "<http://127.0.0.1:8051/graphql/>"
payload="{\\"query\\":\\"query {\\\\n getFormCategories(first:8, after: \\\\\\"\\\\\\") {\\\\n totalCount\\\\n pageInfo {\\\\n startCursor\\\\n endCursor\\\\n hasPreviousPage\\\\n hasNextPage\\\\n }\\\\n edges {\\\\n cursor\\\\n node{\\\\n slug\\\\n title\\\\n sharedAccess\\\\n parentCategory{\\\\n slug\\\\n title\\\\n }\\\\n subcategories{\\\\n slug\\\\n }\\\\n }\\\\n }\\\\n }\\\\n}\\",\\"variables\\":{}}"
headers = {
'x-api-key': 'c0af8b85020275569c998e932d6a4ebaecd3ef79',
'Content-Type': 'application/json',
'Cookie': 'csrftoken=rCDvasXPtiGe6j33bEmFcQFW4P7qaf2APwJ3Y11nko94Mw6ADxlZeKGXiIH6ek8Y',
'Authorization': 'JWT your-token'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.json())
Delete Row
GraphQL API address: https://api.formaloo.net/graphql/
Method: POST
Operation name: deleteRow
Request body example:
mutation{
deleteRow(
input: {
slug: "row_slug"
}
) {
row {
slug
}
}
}
Code in python:
import requests
url = "<http://127.0.0.1:8051/graphql/>"
payload="{\\"query\\":\\"mutation{\\\\n deleteRow(\\\\n input: {\\\\n slug: \\\\\\"row_slug\\\\\\"\\\\n }\\\\n ) {\\\\n row {\\\\n slug\\\\n }\\\\n }\\\\n}\\\\n\\",\\"variables\\":{}}"
headers = {
'x-api-key': 'c0af8b85020275569c998e932d6a4ebaecd3ef79',
'Content-Type': 'application/json',
'Cookie': 'csrftoken=rCDvasXPtiGe6j33bEmFcQFW4P7qaf2APwJ3Y11nko94Mw6ADxlZeKGXiIH6ek8Y',
'Authorization': 'JWT your-token'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.json())
Delete Form
GraphQL API address: https://api.formaloo.net/graphql/
Method: POST
Operation name: deleteForm
Request body example:
mutation{
deleteForm(
input: {
slug: "form_slug"
}
) {
form {
slug
}
}
}
Code in python:
import requests
url = "<http://127.0.0.1:8051/graphql/>"
payload="{\\"query\\":\\"mutation{\\\\n deleteForm(\\\\n input: {\\\\n slug: \\\\\\"form_slug\\\\\\"\\\\n }\\\\n ) {\\\\n form {\\\\n slug\\\\n }\\\\n }\\\\n}\\\\n\\",\\"variables\\":{}}"
headers = {
'x-api-key': 'c0af8b85020275569c998e932d6a4ebaecd3ef79',
'Content-Type': 'application/json',
'Cookie': 'csrftoken=rCDvasXPtiGe6j33bEmFcQFW4P7qaf2APwJ3Y11nko94Mw6ADxlZeKGXiIH6ek8Y',
'Authorization': 'JWT your-token'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.json())
Delete Form-Category
GraphQL API address: https://api.formaloo.net/graphql/
Method: POST
Operation name: deleteCategory
Request body example:
mutation{
deleteCategory(
input: {
slug: "form_category_slug"
}
) {
category {
slug
title
}
}
}
Code in python:
import requests
url = "<http://127.0.0.1:8051/graphql/>"
payload="{\\"query\\":\\"mutation{\\\\n deleteCategory(\\\\n input: {\\\\n slug: \\\\\\"form_category_slug\\\\\\"\\\\n }\\\\n ) {\\\\n category {\\\\n slug\\\\n title\\\\n }\\\\n }\\\\n}\\\\n\\",\\"variables\\":{}}"
headers = {
'x-api-key': 'c0af8b85020275569c998e932d6a4ebaecd3ef79',
'Content-Type': 'application/json',
'Cookie': 'csrftoken=rCDvasXPtiGe6j33bEmFcQFW4P7qaf2APwJ3Y11nko94Mw6ADxlZeKGXiIH6ek8Y',
'Authorization': 'JWT your-token'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.json())
For more useful content check our Blog page and subscribe to our Youtube channel.