Building a Schema
MarketPay's Schema Builder empowers companies to create custom JSON schemas tailored to their unique data processing needs. By defining specific inputs and outputs, you can efficiently handle unstructured text or images, transforming them into structured data for analysis, storage, or further processing.
This guide provides extensive documentation on using the Schema Builder and interacting with our API. You'll learn how to:
Build custom schemas using our intuitive interface.
Define fields, data types, and nested structures.
Integrate with the API to submit data and receive structured responses.
Utilize examples to accelerate your development process.
Understanding Schemas
A schema is a blueprint that defines the structure of your data. In the context of MarketPay, a schema specifies the expected fields, data types, and hierarchical relationships within your JSON data. By creating a schema, you:
Ensure Data Consistency: Validate incoming data against the schema to maintain uniformity.
Facilitate Data Processing: Streamline parsing and processing by knowing the exact data structure.
Enhance Data Validation: Automatically check for required fields and correct data types.
Using the Schema Builder
Our Schema Builder offers two primary methods for creating schemas:
Click-to-Build Interface: An interactive UI that allows you to construct schemas without writing code.
Copy-and-Paste Functionality: Directly paste your existing JSON schema for quick setup.
Click-to-Build Schema Builder
The interactive Schema Builder provides a user-friendly interface to define your schema's fields and structure.
Steps to Build a Schema:
Access the Schema Builder: Navigate to the Schema Builder in your MarketPay dashboard.
Add Fields: Click on the "Add Field" button to create a new field.
Define Field Attributes:
Key: A unique identifier for the field (e.g.,
damage_location
).Field Name: A human-readable name (e.g.,
Damage Location
).Type: Choose the data type (e.g.,
string
,number
,boolean
,array
,object
,picklist
,multi-select-picklist
).Description: Provide a brief explanation of the field's purpose.
Specify Possible Values (for picklists):
Enter possible values for single or multi-select picklists.
Add Nested Fields (for objects and arrays):
Expand the field to add child fields, defining their attributes similarly.
Review and Save: Once all fields are defined, review your schema and save it.
Field Types Explained:
String: Textual data.
Number: Numerical data.
Boolean:
true
orfalse
values.Array: A list of items, which can be of any data type.
Object: A nested set of key-value pairs.
Picklist: A dropdown selection with predefined options (single selection).
Multi-Select Picklist: A selection allowing multiple choices from predefined options.
Copy-and-Paste Functionality
If you have an existing JSON schema, you can directly paste it into the Schema Builder.
Steps:
Switch to Raw JSON View:
Toggle the "Interactive View" switch to enter the "Raw JSON View".
Paste Your Schema:
Copy your JSON schema and paste it into the text area.
Validate and Edit:
The Schema Builder will parse the JSON. You can switch back to the interactive view to make further edits if needed.
Save the Schema:
Once satisfied, save your schema for use with the API.
API Specification
Integrate your schema with MarketPay's API to process unstructured text or images and receive structured data based on your schema.
Authentication
All API requests require authentication via an API key.
API Key: Obtain your API key from the MarketPay dashboard.
Header: Include the API key in the request header as
Authorization: Bearer YOUR_API_KEY
.
Endpoints
Submit Data for Processing
URL:
https://api.marketpay.com/v1/process
Method:
POST
Headers:
Content-Type: application/json
Authorization: Bearer YOUR_API_KEY
Body Parameters:
schema_id
(string): The ID of the schema you want to use.data
(object): The unstructured text or images to be processed.
Retrieve Processed Data
URL:
https://api.marketpay.com/v1/results/{job_id}
Method:
GET
Headers:
Authorization: Bearer YOUR_API_KEY
Path Parameters:
job_id
(string): The ID of the processing job.
Request and Response Formats
Submit Data Request Example
Submit Data Response Example
Retrieve Processed Data Response Example
Examples
Example Schema
Below is an example of a schema defining various fields related to property damage assessments.
Example API Requests and Responses
Submitting Data for Processing
Request:
Response:
Retrieving Processed Data
Request:
Response:
Conclusion
By leveraging MarketPay's Schema Builder and API, you can effectively transform unstructured text and images into structured data tailored to your business needs. Whether you're assessing property damage, analyzing customer feedback, or processing any form of unstructured data, our tools provide the flexibility and power to get the job done efficiently.
For further assistance, please refer to our API Documentation or contact our support team at support@marketpay.com.
Last updated