To upload files for use in content page fields (such as images, documents, or media), follow these steps:
Also in this article:
Upload the File
Call the /{objectTypeEndpoint}/fileupload endpoint to upload your content file to the temporary folder.
Sample Response:
[
{
"FileName": "Earth-Day-5k.jpg",
"UniqueServerFileId": "BodyPart_ec27d0d4-1256-4425-ad26-bf3bfa4895ab_remotecopy",
"FileExpiryUTC": "2025-09-01T08:23:41.6179727Z"
}
]Get the Unique Server File ID
From the upload response above, copy the UniqueServerFileId value (BodyPart_ec27d0d4-1256-4425-ad26-bf3bfa4895ab_remotecopy). This is a temporary identifier that references your uploaded file.
Reference the File in Content Fields
When creating or updating content pages, use the UniqueServerFileId in the UrlOrId field of file upload type fields.
Example Usage
For an Image Upload field (Type 90) like "OC Page Image":
"OC Page Image": {
"Type": 90,
"Value": {
"UrlOrId": "BodyPart_ec27d0d4-1256-4425-ad26-bf3bfa4895ab_remotecopy",
"AltText": "Earth Day 5k",
"FileName": "Earth-Day-5k.jpg",
"Transcript": null
}
}
For Document Upload fields (Type 100) or Media Upload fields (Type 120), use the same structure:
"OC Document Attachment": {
"Type": 100,
"Value": {
"UrlOrId": "BodyPart_a5ab71c2-a7b3-484f-8d81-73572db06364_remotecopy",
"AltText": "Project Report",
"FileName": "project-report.pdf",
"Transcript": null
}
}Important Notes
- The
UniqueServerFileIdis temporary and has an expiry time (FileExpiryUTC) - Once you create or update the content page with this ID, OpenCities will move the file from the temporary folder to its permanent location
- Always use the
UniqueServerFileIdfrom the upload response - do not modify this value - The
FileNameshould match the original filename you uploaded
Search Content Pages
Endpoint: GET /{objectTypeEndpoint}/search
Authentication: Required
Description: Search for content pages using keywords and field-specific parameters.
Parameters
| Parameter | Type | Required | Description |
| objectTypeEndpoint | string | Yes |
The endpoint of the object type (path parameter). To find this value, go to More > Content Types, select your content type, and copy the Endpoint for API value. |
| parameters | string | Yes | Encoded JSON input containing search criteria (query parameter). |
Sample Request
curl -u "your_app_id:your_api_key" \ -H "Content-Type: application/json" \ "https://your-domain.com/api/v1/oc-events/search?parameters=%7B%22Keyword%22%3A%22pet%22%2C%22Parameters%22%3A%7B%22OC%20Event%20Categories%22%3A%5B%22Major%20Events%22%5D%7D%2C%22SearchLocation%22%3A%2264141ff0-f9ab-47d4-b47c-c78684ab1329%22%2C%22Properties%22%3A%5B%22OC%20Title%22%2C%22OC%20cost%22%2C%22OC%20Additional%20Address%20Information%22%5D%2C%22PageSize%22%3A3%2C%22Index%22%3A0%2C%22LanguageCode%22%3A%22en-AU%22%7D"
Search Request JSON Structure
{
"Keyword": "pet",
"Parameters": {
"OC Event Categories": [
"Major Events"
]
},
"SearchLocation": "64141ff0-f9ab-47d4-b47c-c78684ab1329",
"Properties": [
"OC Title",
"OC cost",
"OC Additional Address Information"
],
"PageSize": 3,
"Index": 0,
"LanguageCode": "en-AU"
}Search Request Properties
| Property | Description | Notes |
| Keyword | Search keyword to be used | Behaves similar to keyword search found in any search listings in the site. |
| Parameters | List of search conditions as parameter | The parameter name is the field name and the value would be based on type of field. |
| SearchLocation | ID of the page under which the application should search for pages | Includes pages from all levels. |
| SortBy | Sort by field {1 | from} |
| Properties | Set of fields to be returned in the response | "OC Title","OC Short Description","OC Keywrds","OC Body Content","OC Composite Date" |
| PageSize | Number of results per page | |
| Index | Start index of the result set | |
| LanguageCode | Used to pick only content applicable to specific language |
Field Parameter Formats
Date Fields
"Parameters": {
"OC Composite Date": {
"StartDate": "2025-08-26 00:00:00",
"EndDate": "2025-09-26 00:00:00"
}
}Note: Defaults to installation default timezone. At least one of the dates is mandatory.
Tree Fields
"Parameters": {
"OC Business Category": {
"Nodes": [["Accommodation"],
["Arts and culture"]],
"MatchingLogic":0
}
}
The nodes are based on list of individual nodes that should match. Each element should be constructed with the edge nodes entire hierarchy in it.Note: The nodes are based on list of individual nodes that should match. Each element should be constructed with the edge nodes entire hierarchy in it.
Checkbox List / List Box / Tag Fields
"Parameters": {
"OC News Categories": {
"Values": [
"Business & Economy",
"Family",
"Youth"
],
"MatchingLogic": 1
}
}Note: Should include a list of matching values from the field options.
All Other Field Types
"Parameters": {
"OC Title": "business"
}Note: Accept a single input string as a search value for that field. Depending on if the field is a free format or predefined, the input is used for either exact or partial matches. For example, if the field is a text box or WYSIWYG field, then it's considered for partial match If the field is a radiobutton or dropdown field, then it's considered for an exact match.
Matching Logic Values
| Value | Logic | Description |
| 0 | OR | Match any of the specified values |
| 1 | AND | Match all of the specified values |
| 2 | NOT | Exclude the specified values |
Field Matching Behavior
- Text Box / WYSIWYG Fields: Partial match search
- Radio Button / Dropdown Fields: Exact match search