PPOM API Guide

User Manual:

Open the PDF directly: View PDF PDF.
Page Count: 13

DownloadPPOM API Guide
Open PDF In BrowserView PDF
PPOM API Documentation
Version 1.0
(beta)
Enable Rest API

3

Endpoint

3

Products - Operations

3

1- Get all ppom fields attached with product.

3

2- Set/Update PPOM Fields

4

3- Delete Fields

6

// Delete all fields against product
Order- Operations

6
8

1- Get all meta data information attached with Order

8

2- Set/Update Meta/Fields against order

9

Return: All meta fields attached to order
3- Delete Meta/Fields in Order
Return: All meta fields attached to order
3- Field Types Table
3.1- Options

9
10
10
11
11

PPOM ​version 11.8+ now have API support. It's a beta release.
Following is information about API operations.

Enable Rest API
Make sure REST API is enabled from WooCommerce → Setttings → PPOM API Tab.

Endpoint
Base Endpoint : siteurl/wp-json/ppom/v1/{$operations}

Products - Operations
1- Get all ppom fields attached with product.
1.1 Operation

get/product/?product_id=238&secret_key=11122

1.2 Method

GET

1.3 Parameters
Key

1.4 Example Response

Type

Detail

product_id

integer

mandatory

secret_key

string

mandatory

{

"status"​:​ ​"success",
"message"​:​ ​"Meta found 121",
"meta_id"​:​ ​121,
"product_id"​:​ ​238,
"ppom_fields"​:​ ​[{
"title"​:​ ​"My text",
"type"​:​ ​"text",
"data_name"​:​ ​"my_test",
"description"​:​ ​"Just a text input",
"required"​:​ 1
},​ {
"title"​:​ ​"My text 23",
"type"​:​ ​"text",
"data_name"​:​ ​"my_test3",
"description"​:​ ​"Another text",
"required"​:​ 1
},​ {
"title"​:​ ​"Type your email",
"type"​:​ ​"email",
"data_name"​:​ ​"your_email",
"description"​:​ ​"Email please",
"required"​:​ 1
}]
}

Other Status

success: if operation successful
no_product: if product is not found
no_meta: if no fields/meta attached with product

2- Set/Update PPOM Fields
If requested fields are exists, it will update otherwise add them to product. If no PPOM meta
is attached to product then it will create a new meta group with same name as of Product
title in WooCommerce and add these fields.
2.1 Operation

set/product/

2.2 Method

POST

2.3 Parameters
Key

Type

Detail

product_id

integer

mandatory

secret_key

string

mandatory

fields

Array (see section
3.0)
(json_encode)

mandatory

2.4 Fields Meta
Fields

See section 3-Fields Types

Options

2.5 Example Request

Extra options for Checkbox,Radio,Select

Property

Type

options

Array (see section 2.5)

$ppom_fields ​=​ array(
array​(​'title'​
​=>​ ​'My text',
​'type'​
​=>​ ​'text',
​'data_name'​ ​=>​ ​'my_test',
​'description'​
​=>​ ​'Just a text input',
​'required'​ ​=>​ ​1​),
array​(​'title'​
​=>​ ​'Package',
​'type'​
​=>​ ​'checkbox',
​'data_name'​ ​=>​ ​'package',
​'description'​
​=>​ ​'Select Package',
​'options'​
​=>​ array(
array​(​'option'​=>​"Basic"​,​'price'​=>​''​),
array​(​'option'​=>​"Student"​,​'price'​=>​'5.20'​),
array​(​'option'​=>​"Super"​,​'price'​=>​'5%'​),
​),
​'required'​ ​=>​ ​1​),
array​(​'title'​
​=>​ ​'Type your email',
​'type'​
​=>​ ​'email',
​'data_name'​ ​=>​ ​'your_email',
​'description'​
​=>​ ​'Email please',
​'required'​ ​=>​ ​1​),
​);

Actual Post Request
$post_data ​=​ array​(​'product_id'​ ​=>​ ​238,
​'secret_key'​ ​=>​ 123123​,
​'fields'​
​=>​ json_encode​(​$ppom_fields​),
​);

2.6 Example
Response

{
"status": "success",
"meta_id": 122,
"product_id": 238,
"fields": [{
"title": "My text",
"type": "text",
"data_name": "my_test",
"description": "Just a text input",
"required": 1

}, {
"title": "Package",
"type": "checkbox",
"data_name": "package",
"description": "Select Package",
"options": [{
"option": "Basic",
"price": ""
}, {
"option": "Student",
"price": "5.20"
}, {
"option": "Super",
"price": "5%"
}],
"required": 1
}, {
"title": "Type your email",
"type": "email",
"data_name": "your_email",
"description": "Email please",
"required": 1
}]
}

3- Delete Fields
3.1 Operation

delete/product/

3.2 Method

POST

3.3 Parameters
Key

3.4 Example Request

Type

Detail

product_id

integer

mandatory

secret_key

string

mandatory

fields

Array (only
data_name)

mandatory

$delete_fields ​=​ array​('​field_1​','​field_2​');
$post_data ​=​ array​(​'product_id'​ ​=>​ ​238,
​'secret_key'​ ​=>​ 123123​,
​'fields'​
​=>​ json_encode​(​$delete_fields​),
​);

// Delete all fields against product
$delete_fields ​=​ array​('​__all_keys​');

3.5 Example Response

{

}

"status"​:​ ​"success"​,
"meta_id"​:​ ​"123"​,
"product_id"​:​ ​238​,
"fields"​:​ ​[{
"title"​:​ ​"My text"​,
"type"​:​ ​"text"​,
"data_name"​:​ ​"my_test"​,
"description"​:​ ​"Just a text input"​,
"required"​:​ ​1
},​ ​{
"title"​:​ ​"Package"​,
"type"​:​ ​"checkbox"​,
"data_name"​:​ ​"package"​,
"description"​:​ ​"Select Package"​,
"options"​:​ ​[{
"option"​:​ ​"Basic"​,
"price"​:​ ​""
},​ ​{
"option"​:​ ​"Student"​,
"price"​:​ ​"5.20"
},​ ​{
"option"​:​ ​"Super"​,
"price"​:​ ​"7%"
}],
"required"​:​ ​0
}]

Order- Operations
1- Get all meta data information attached with Order
1.1 Operation

get/order/?order_id=2141&secret_key=11122

1.2 Method

GET

1.3 Parameters
Key

1.4 Example Response

Type

Detail

order_id

integer

mandatory

secret_key

string

mandatory

{

"status"​:​ ​"success",
"message"​:​ ​"Order found 2141",
"order_items_meta"​:​ ​[{
"product_id"​:​ ​2028,
"product_meta_data"​:​ ​[{
"id"​:​ ​3932,
"key"​:​ ​"thehidden",
"value"​:​ ​"22"
},​ {
"id"​:​ ​3933,
"key"​:​ ​"you_compaany",
"value"​:​ ​"nmedia"
},​ {
"id"​:​ ​3934,
"key"​:​ ​"about_compny",
"value"​:​ ​"I love Again"
},​ {
"id"​:​ ​3935,
"key"​:​ ​"email_input",
"value"​:​ ​"najeeb.ahmd82@gmail.com"
},​ {
"id"​:​ ​3936,
"key"​:​ ​"dob",
"value"​:​ ​"28-2-2200"
},​ {
"id"​:​ ​3937,
"key"​:​ ​"gender",
"value"​:​ ​"Male"
},​ {
"id"​:​ ​3938,
"key"​:​ ​"your_date_range",
"value"​:​ ​"22"
},​ {
"id"​:​ ​3939,
"key"​:​ ​"select_timzone",
"value"​:​ ​"22"
},​ {
"id"​:​ ​3940,
"key"​:​ ​"your_interest",
"value"​:​ ​"22"

},​ {

},​ {

},​ {

},​ {

}]

"id"​:​ ​3941,
"key"​:​ ​"chose_itww",
"value"​:​ ​"extra,upsize"
"id"​:​ ​3942,
"key"​:​ ​"colors_palettes",
"value"​:​ ​"22"
"id"​:​ ​3943,
"key"​:​ ​"select_image",
"value"​:​ ​"22"
"id"​:​ ​3951,
"key"​:​ ​"your_age",
"value"​:​ ​"22"

}]
}

Other Status

success: if operation successful
no_order: if order is not found

Checkbox value

Checkbox values will be shown as separated by comma link see
above under key: ​chose_itww

2- Set/Update Meta/Fields against order
If requested fields are exists, it will update otherwise add them to order.
Return: All meta fields attached to order
2.1 Operation

set/order/

2.2 Method

POST

2.3 Parameters
Key

2.4 Example Request

Type

Detail

order_id

integer

mandatory

secret_key

string

mandatory

fields

Array (see section
2.4)
(json_encode)

mandatory

$ppom_fields ​=​ array​(
2028​ ​=>​ array​(
'about_compny'​=>​'I love Again'​,
'email_input'​=>​'najeeb.ahmd82@gmail.com'​,
​'your_age'​=>​36​),
​);

$post_data ​=​ array​(​'product_id'​ ​=>​ ​238,
​'secret_key'​ ​=>​ 123123​,
​'fields'​
​=>​ json_encode​(​$ppom_fields​),
​);

In above example $ppom_fields has key as item id in order with
array is given with data_name=>value pair.
2.5 Example
Response

Same as in 1.4 in Orders

3- Delete Meta/Fields in Order
Return: All meta fields attached to order
2.1 Operation

delete/order/

2.2 Method

POST

2.3 Parameters
Key

2.4 Example Request

Type

Detail

order_id

integer

mandatory

secret_key

string

mandatory

fields

Array (see section
2.4)
(json_encode)

mandatory

$delete_fields ​=​ array(
​2028​ ​=>​ array​('​your_email​',​ ​'​select_image​'),
​);
$post_data ​=​ array​(​'product_id'​ ​=>​ ​238,
​'secret_key'​ ​=>​ 123123​,
​'fields'​
​=>​ json_encode​(​$delete_fields​),
​);

In above example $​delete_fields​ has key as item id in order with
array is given with data_name=>value pair.

Same as in 1.4 in Orders

3- Field Types Table
Field

type

data_name

title

description

required

options

Text

text

unique

ANY

ANY

true:1,false: 0

N/A

Email

email

unique

ANY

ANY

true:1,false: 0

N/A

Date

date

unique

ANY

ANY

true:1,false: 0

N/A

Number

number

unique

ANY

ANY

true:1,false: 0

N/A

Textarea

textarea

unique

ANY

ANY

true:1,false: 0

N/A

Date
Range

daterange

unique

ANY

ANY

true:1,false: 0

N/A

Timezone

timezone

unique

ANY

ANY

true:1,false: 0

N/A

Color
Picker

color

unique

ANY

ANY

true:1,false: 0

N/A

Select

select

unique

ANY

ANY

true:1,false: 0

See section 3.1

Radio

radio

unique

ANY

ANY

true:1,false: 0

See section 3.1

Checkbox

checkbox

unique

ANY

ANY

true:1,false: 0

See section 3.1

3.1- Options
Options is an array with following keys:
'options'​

​=>​ array(

);

array​(​'option'​=>​"Basic"​,​'price'​=>​''​),
array​(​'option'​=>​"Student"​,​'price'​=>​'5.20'​),
array​(​'option'​=>​"Super"​,​'price'​=>​'5%'​),

Note: It’s just a beta release. If you see any issue or want to improve this guide please feel
free to contact us at ​sales@najeebmedia.com



Source Exif Data:
File Type                       : PDF
File Type Extension             : pdf
MIME Type                       : application/pdf
PDF Version                     : 1.5
Linearized                      : Yes
Producer                        : Skia/PDF m68
Page Count                      : 13
EXIF Metadata provided by EXIF.tools

Navigation menu