Reviews

The reviews endpoints allow you to retrieve, create, update, and delete information about reviews in a database.


List all reviews

This query allows you to retrieve a paginated list of all your reviews. By default, a maximum of 25 reviews are shown per page.

Arguments

  • Name
    query
    Type
    String!
    Description

    Supported filter parameters: order_by order_dir product_id

  • Name
    after
    Type
    String
    Description

    Returns the elements that come after the specified cursor.

  • Name
    first
    Type
    String
    Description

    Returns up to the first n elements from the list.

Fields

  • Label
    Review!
    Description

    The Review query type.

Request

POST
https://api.lightfunnels.com/graphql
query reviewsQuery($first: Int, $after: String, $query: String!){
	reviews(query: "order_by:id order_dir:desc last_month", after: "WzVE4OTA5LDEe/4OTA5XQ==", first: 10){
		edges{
			node{
				id
				_id
				name
				email
				content
				rate
				published
				avatar
				created_at
				updated_at							
				...
			}
			cursor
		}
		pageInfo{
			endCursor
			hasNextPage
		}
	}
}

Response

{
		"data": {
			"pagination": {
				"edges": [{
					"node": {
						"id": "UmV2aWV3OjQ4NDUy",
						"_id": 48452,
						"name": "Yassir Ennazk",
						"email": "Yassir@lightfunnels.com",
						"content": "some text",
						"rate": 5,
						"published": true,
						"avatar": "//www.gravatar.com/avatar/...",
						"created_at": "a few seconds ago",
						"updated_at": "a few seconds ago",
						"__typename": "Review"
						...
					},
					"cursor": "WzQ4NDUyLDQ4NDUyXQ=="
				}],
				"pageInfo": {
					"endCursor": "WzQ4NDUyLDQ4NDUyXQ==",
					"hasNextPage": false
				}
			}
		}
	}

Create a review

This query allows you to add a new review.

Arguments

  • Name
    product_id
    Type
    Int!
    Description

    The review product id.

  • Label
    InputReview!
    Description

    The InputReview type.

Fields

  • Label
    Review!
    Description

    The Review query type.

Request

POST
https://api.lightfunnels.com/graphql
mutation mutationName($product_id: Int!, $node: InputReview!) {
	createReview(product_id: $product_id, node: $node){
		# Review type fields
	}
}

Response

{
		"data": {
			"pagination": {
				"edges": [{
					"node": {
						"id": "UmV2aWV3OjQ4NDUy",
						"name": "Yassir Ennazk",
						"email": "Yassir@lightfunnels.com",
						"content": "some text",
						...
					},
					"cursor": "WzQ4NDUyLDQ4NDUyXQ=="
				}],
				"pageInfo": {
					"endCursor": "WzQ4NDUyLDQ4NDUyXQ==",
					"hasNextPage": false
				}
			}
		}
	}

Retrieve a review

This query allows you to retrieve a review by providing their id.

Arguments

  • Name
    id
    Type
    ID!
    Description

    The review id.

Fields

  • Label
    Review!
    Description

    The Review query type.

Request

POST
https://api.lightfunnels.com/graphql
	query reviewQuery($id: Int!){
		review(id: $id){
			# Review type fields
		}
	}

Response

{
		"data": {
			"pagination": {
				"edges": [{
					"node": {
						"id": "UmV2aWV3OjQ4NDUy",
						"name": "Yassir Ennazk",
						"email": "Yassir@lightfunnels.com",
						"content": "some text",
						...
					},
					"cursor": "WzQ4NDUyLDQ4NDUyXQ=="
				}],
				"pageInfo": {
					"endCursor": "WzQ4NDUyLDQ4NDUyXQ==",
					"hasNextPage": false
				}
			}
		}
	}

Update a Review

This query allows you to perform an update on a Review.

Arguments

  • Name
    id
    Type
    Int!
    Description

    The review id.

  • Name
    node
    Label
    InputUpdateReview!
    Description

    The review node.

Fields

  • Label
    Review!
    Description

    The Review query type.

Request

Post
https://api.lightfunnels.com/graphql
mutation updateReviewMutation($node: InputUpdateReview!, $id: Int!){
		updateReview(node: $node, id: $id){
			# Review type fields
		}
	}

Response

{
		"data": {
			"pagination": {
				"edges": [{
					"node": {
						"id": "UmV2aWV3OjQ4NDUy",
						"name": "Yassir Ennazk",
						"email": "Yassir@lightfunnels.com",
						"content": "some text",
						...
					},
					"cursor": "WzQ4NDUyLDQ4NDUyXQ=="
				}],
				"pageInfo": {
					"endCursor": "WzQ4NDUyLDQ4NDUyXQ==",
					"hasNextPage": false
				}
			}
		}
	}

Delete a Review

This query allows you to delete reviews.

Arguments

  • Name
    items
    Type
    [ID!]!
    Description

    The review ids.

Fields

  • Name
    [ID]
    Description

    List of review ids.

Request

POST
https://api.lightfunnels.com/graphql
	mutation deleteReviewsMutation($items: [ID!]!){
		deleteReviews(items: $items){
			# [ID] type field
		}
	}

Response

{
	"data": {
		"deleteReviews": [
			"UHJvZHVjdDoxNTUxMQ==",
			"UHJvZHVjdFKWATUxMQ=="
		]
	}
}