TransWikia.com

REST API service URI Not working from Postman/other REST Clients,but working fine with Workbench

Salesforce Asked by Hari E on December 22, 2021

Am trying to Insert/Upload a File(Base64) from Rest Client by mentioning

https://mysalesforce-instance.com/services/data/v48.0/sobjects/ContentVersion
by giving Body as

{
"Title":"New Upload",
"PathOnClient":"NewUpload.JPG",
"ContentLocation":"S",
"OwnerId":"<My Id>",
"VersionData":"file base64 information"
}

Passing headers with the Authorization access token
and Content-type apllication/json;charset=UTF-8

I can able to get response from Workbench,
but when I have done this in Postman/ARC am getting ContentVersion object description like below.
but not getting successful ID. Kindly let me know is there any thing I need to do.

{
    "objectDescribe": {
        "activateable": false,
        "createable": true,
        "custom": false,
        "customSetting": false,
        "deepCloneable": false,
        "deletable": false,
        "deprecatedAndHidden": false,
        "feedEnabled": false,
        "hasSubtypes": false,
        "isInterface": false,
        "isSubtype": false,
        "keyPrefix": "068",
        "label": "Content Version",
        "labelPlural": "Content Versions",
        "layoutable": true,
        "mergeable": false,
        "mruEnabled": false,
        "name": "ContentVersion",
        "queryable": true,
        "replicateable": false,
        "retrieveable": true,
        "searchable": true,
        "triggerable": true,
        "undeletable": false,
        "updateable": true,
        "urls": {
            "compactLayouts": "/services/data/v48.0/sobjects/ContentVersion/describe/compactLayouts",
            "rowTemplate": "/services/data/v48.0/sobjects/ContentVersion/{ID}",
            "defaultValues": "/services/data/v48.0/sobjects/ContentVersion/defaultValues?recordTypeId&fields",
            "describe": "/services/data/v48.0/sobjects/ContentVersion/describe",
            "layouts": "/services/data/v48.0/sobjects/ContentVersion/describe/layouts",
            "sobject": "/services/data/v48.0/sobjects/ContentVersion"
        }
    },
    "recentItems": []
}

2 Answers

When I had the same issue, it turns out that I was pointing to the wrong endpoint url.

My initial (wrong) url endpoint was https://{instance}.lightning.force.com/services/data/...

when it should have been

https://{instance}.my.salesforce.com/services/data/...

Unfortunately instead of getting a not found error, I got the object description returned.

Answered by Kyle J V on December 22, 2021

You are using the wrong HTTP method. If you perform an HTTP GET to /services/data/v48.0/sobjects/ContentVersion, you will obtain the response body shown.

This is the sObject Basic Information endpoint. To create a record, you should be using POST.

Answered by David Reed on December 22, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP