Skip to content

Create remote file mapping

Request

POST /v3/remote-file-mappings

Create a new remote file mapping configuration

Security
API_Key
Query
accountIdinteger

Account ID to create the mapping for

Example:accountId=123
Bodyapplication/jsonrequired

Remote file mapping data for creation

namestring, <= 255 charactersrequired

A user-supplied name to identify this RFM config

Example:"Google Analytics Replacement"
fileIdstring or null

A string GUID used as the uploaded replacement file's "name" in S3

Example:"8c59d02b-6ebc-4893-9391-9be26c6d34cc"
fileUrlstring or null, <= 5000 characters

The replacement URL, or else the name of the replacement file before it was uploaded

Example:"https://example.com/replacement-script.js"
matchTypestringrequired

Either "regex" or "equals"

Enum:"equals""regex"
Example:"equals"
matchValuestringrequired

The request URL to be replaced (or the regex that matches URLs to replace)

Example:"https://www.google-analytics.com/analytics.js"
POST
/v3/remote-file-mappings
curl -i -X POST \
  'https://api.observepoint.com/v3/remote-file-mappings?accountId=123' \
  -H 'Authorization: YOUR_API_KEY_HERE' \
  -H 'Content-Type: application/json' \
  -d '{
    "name": "Google Analytics Replacement",
    "fileId": "8c59d02b-6ebc-4893-9391-9be26c6d34cc",
    "fileUrl": "https://example.com/replacement-script.js",
    "matchType": "equals",
    "matchValue": "https://www.google-analytics.com/analytics.js"
  }'

Responses

Remote file mapping created successfully

Bodyapplication/json
idinteger, (int64)required

Simple surrogate key in the database for this RFM config

Example:123
namestring, <= 255 charactersrequired

A user-supplied name to identify this RFM config

Example:"Google Analytics Replacement"
fileIdstring or null

A string GUID used as the uploaded replacement file's "name" in S3

Example:"8c59d02b-6ebc-4893-9391-9be26c6d34cc"
fileUrlstring or null, <= 5000 characters

The replacement URL, or else the name of the replacement file before it was uploaded

Example:"https://example.com/replacement-script.js"
matchTypestringrequired

Either "regex" or "equals"

Enum:"equals""regex"
Example:"equals"
matchValuestringrequired

The request URL to be replaced (or the regex that matches URLs to replace)

Example:"https://www.google-analytics.com/analytics.js"
accountIdintegerrequired

Foreign key reference to accounts table. The owner of this RemoteFileMapping

Example:343
createdByintegerrequired

Foreign key reference to the users table. Who created this RFM?

Example:1362
createdAtstring, (date-time)required

When this RFM was created

Example:"2024-01-01T10:15:00.000Z"
updatedByintegerrequired

Foreign key reference to the users table. Who updated this RFM most recently?

Example:1362
updatedAtstring, (date-time)required

When this RFM was last updated

Example:"2024-01-02T10:15:00.000Z"
Response
{ "id": 123, "name": "Google Analytics Replacement", "fileId": "8c59d02b-6ebc-4893-9391-9be26c6d34cc", "fileUrl": "https://example.com/replacement-script.js", "matchType": "equals", "matchValue": "https://www.google-analytics.com/analytics.js", "accountId": 343, "createdBy": 1362, "createdAt": "2024-01-01T10:15:00.000Z", "updatedBy": 1362, "updatedAt": "2024-01-02T10:15:00.000Z" }