{"activeVersionTag":"latest","latestAvailableVersionTag":"latest","collection":{"info":{"_postman_id":"cd74d81b-aacf-43e9-93d6-24d805e85dd3","name":"SugarMarket RESTFUL API","description":"Sugar Market provides a self-serve RESTful API. The SugarMarket API exposes the core entities of the Sugar Market automated marketing platform to allow integrators, partners, and customers the opportunity to manipulate and retrieve backend state.\n\n### Base URL\n\nThe base URL for connecting to the SugarMarket API is follows:\n\n[https://developer.salesfusion.com/api/2.0/](https://developer.salesfusion.com/api/2.0/)\n\n### Authentication\n\nThe SugarMarket API utilizes two authentication methods:\n\n- HTTP Basic Authentication through TLS/SSL\n    \n- Token-based Authentication\n    \n\n#### HTTP Basic Authentication\n\nTo authenticate an HTTP request, the request must contain a properly formatted Authorization field in the HTTP headers. This requires that the user credentials be formatted correctly, encoded as a base64 string, and included in the Authorization field.\n\nThe sample code below demonstrates this process:\n\n```\n// The Basic Authentication format expected is user@domain:password\n// (i.e. john@domain:password, or john@email.tld@domain:password)\nprivate static string user_credentials = string.Format(\n    \"{0}@{1}:{2}\", api_username, api_domain, api_password);\nprivate static string base64_user_credentials = Convert.ToBase64String(\n    Encoding.ASCII.GetBytes(user_credentials));\npublic static string AuthorizationHeader = string.Format(\n    \"Basic {0}\", base64_user_credentials);\n\n ```\n\nThe resulting AuthorizationHeader string looks as follows:\n\n`{{vault:basic-auth}}`\n\nThis string should subsequently be set as the Authorization field in the HTTP headers for all requests sent to the API as shown below:\n\n`Authorization: {{vault:basic-auth}}`\n\nAs mentioned before, for security, all requests made against the API must be made through TLS/SSL over port 443 (the default port for HTTPS).\n\nNote: the format of the username within the authorization header should be \\[username\\]@\\[login domain\\] where the login domain is the domain you configured during the creation of your SugarMarket account.\n\nA unique API username and user account should be created and authorized to interact with the API. This user account should be separate from any user account associated with the marketing or sales process and requires API Access permissions in order to access the API. In order to authorize a user account for API Access, please follow these steps:\n\n1) Contact your Sugar Market consultant or CSM so they can add the 'Customer-Wide' and 'Customer-Wide - API Access' features.\n\n2) Log into the SugarMarket application using an admin user account.\n\n3) Navigate to Account Configuration and select Roles under the Administrator navigation tree.\n\n4) Create a new role named API Access and check Data Access and Navigation Access.\n\n5) Under the Navigation Access tab, select \"Customer-Wide\" and \"Customer-Wide - API Access\" and add it to the Access Provided list.\n\n6) Click Save and Return.\n\n7) Navigate to User administration and open the target user account for editing.\n\n8) In the user preferences view, select the Roles tab.\n\n9) Click Add New Role and select the previously configured API Access role from the drop-down menu.\n\n10) Click Save.\n\nAlternatively, you can authorize a user account directly to access the API without creating an API Access user role. To do so, follow these steps:\n\n1) Log into the SugarMarket application using an admin user account.\n\n2) Navigate to User administration and open the target user account for editing.\n\n3) Under the Navigation tab, select \"Customer-Wide - API Access\" and add it to the Access Provided list.\n\n#### Token-Based Authentication\n\nTo obtain a token, make a request against the following endpoint providing your username, domain, and password as a JSON blob:  \nPOST [https://developer.salesfusion.com/api/2.0/users/request-token/](https://developer.salesfusion.com/api/2.0/users/request-token/)\n\nHere’s a CURL:\n\n```\ncurl --location --request POST 'https://developer.salesfusion.com/api/2.0/users/request-token/' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{\n    \"username\": \"robparker@axiomfire.com\",\n    \"password\": \"XXXXXXXXXXXXXXX\"\n}'\n\n ```\n\nResponse will look as follows:\n\n```\n200\n{\n   \"token\": \"8ffa19e5b03874a543dda1f97d5acb813a236675\"\n}\n\n ```\n\nYou can then make requests to the API by providing the following HTTP Authorization header:\n\n```\nToken 8ffa19e5b03874a543dda1f97d5acb813a236675\n\n ```\n\nHere’s a CURL:\n\n```\ncurl --location --request GET 'https://developer.salesfusion.com/api/2.0/contacts' \\\n--header 'Authorization: Token 8ffa19e5b03874a543dda1f97d5acb813a236675\n\n ```\n\nTokens will expire after 8 hours. When a token is expired, a request to the API will return the following:\n\n```\n401\n{\n   \"detail\": \"Expired token\"\n}\n\n ```\n\nSubsequent requests to the API will return the following:\n\n```\n401\n{\n   \"Msg\": \"[Invalid token.]\"\n}\n\n ```\n\nAt this point, a new token must be requested.\n\n#### Date Time Formats\n\nAll date/timestamp values passed to and received from the API will be in ISO 8601 format. Timestamp values will reflect Coordinated Universal Time (UTC).\n\n#### Integrating the SugarMarket iFrame feature\n\nThe SugarMarket iframe component provides an easy way to integrate marketing automation data and features into your own application. The iframe is contact-specific and requires the following three query string parameters in order to load properly:\n\n1) orgid = A unique ID assigned to your SugarMarket instance. This value can be retrieved using the /tenant/info endpoint. The returned crm_org_id field reflects your orgid.\n\n2) userid = Your user id as recorded within the CRM. This value can be retrieved using the /tenant/info endpoint. The returned crm_id field reflects your userid.\n\n3) recordid = The contact ID of interest as reflected by the crm_id field returned from the /contacts/ endpoint\n\nThe iframe URL is constructed as follows:\n\n[https://iframe.salesfusion.com/?userId=](https://iframe.salesfusion.com/?userId=)&orgId=&recordId=\n\nOf course, it will be important to populate the crm_id fields for users and contacts within your SugarMarket instance in order to utilize the iframe feature. If your CRM doesn’t automatically populate these fields we recommend either GUIDs or hashes in lieu of IDs.\n\n#### Using Postman and Making Test Calls\n\n1) Download and install postman from here: [https://www.getpostman.com/downloads](https://www.getpostman.com/downloads)\n\n2) Ensure you have completed the steps above to setup your User and API access role to authenticate to the API.\n\nOpen Postman on your machine and get familiar with the layout. For this example we will be querying the contacts table within Sugar Market, formerly known as Salesfusion.\n\n1) Within the Postman app, first we will focus on the bar that says \"Enter Request URL\". In this space we need to put the URL of the RESTFUL API endpoint we would like to call. In this example the URL is:\n\n[https://developer.salesfusion.com/api/2.0/contacts/](https://developer.salesfusion.com/api/2.0/contacts/)\n\n2) We now need to setup Authentication. Click into the \"Authorization\" menu (this menu is opened by default in most cases). In the dropdown menu that states \"Inherit auth from parent\" select the \"Basic Auth\" option. You should now see a Username and Password field on the right side of the screen.\n\nEnter your username and password into the corresponding fields. Your API username is actually the username of the user you created plus the domain name:\n\n[USERNAME@DOMAIN.COM](https://mailto:USERNAME@DOMAIN.COM)\n\nNOTE: Some users may default to having an emailaddress as the username in which case you will need to use the following. It might look a little funny but should work just fine.\n\n[USERNAME@EMAILADDRESS.COM](https://mailto:USERNAME@EMAILADDRESS.COM)@DOMAIN.COM\n\n3) Now that we have authentication setup we can simply make our API call. Just hit the send button! If everything has been done correctly, you should receive a JSON object of your top 100 contacts back! If anything is done incorrectly, you may receive an error. If you are unsure of what this error means please file a case with the Sugar Support team with a screenshot of the error and help will be on the way!\n\n#### Using the Search feature\n\nSearching via the Sugar Marke RESTFUL API is as simple as including a URL parameter in your API call. It does require a specific table be specified(Such as contacts) and cannot be called on the base route. The query is appended to the end of the route. You can perform searches on the all tables presented by the RESTUL API to find relevant information. It is also not limited to a singular field and will search all fields for relevant values (first_name, email, last_name, etc.)\n\nExample below\n\nBase Route:\n\n[https://developer.salesfusion.com/api/2.0/contacts/](https://developer.salesfusion.com/api/2.0/contacts/)\n\nQuery:\n\n?search=tj.southern\n\nCombined:\n\n[https://developer.salesfusion.com/api/2.0/contacts/](https://developer.salesfusion.com/api/2.0/contacts/) ?search=tj.southern\n\n#### Fetching Records by Date Range\n\nFor some scenarios when getting data from the Sugar Market RESTUL API you may want to query a certain entity to only fetch records that fall within a certain date range.\n\nAn example of this would be wanting to fetch all contacts that have been updated in the month of October.\n\nTo do this we can append UTM paramters to our base route like the example below:\n\nBase Route: [https://developer.salesfusion.com/api/2.0/contacts](https://developer.salesfusion.com/api/2.0/contacts)\n\nUTM Parameters: ?date_field=updated_date&start_date=2018-20-01&end_date=2018-10-31\n\nCombined: [https://developer.salesfusion.com/api/2.0/contacts?date_field=updated_date&amp;start_date=2018-09-01T00:01&amp;end_date=2018-09-30T23:59](https://developer.salesfusion.com/api/2.0/contacts?date_field=updated_date&start_date=2018-09-01T00:01&end_date=2018-09-30T23:59)\n\nWithin the appended UTM Parameters the \"date_field\" section can be any date field presented on the given route such as \"Created_date\".\n\n#### Sorting data with the RESTFUL API\n\nSorting data with the Sugar Market RESTFUL API is as simple as adding an additional parameter to your base route. The sorting function can be called on all tables but can ONLY be used on standard fields as custom fields are not preset in paginated views at this time.\n\nExample:  \nBase URL:\n\n[https://developer.salesfusion.com/api/2.0/contacts/](https://developer.salesfusion.com/api/2.0/contacts/)\n\nQuery:  \n?ordering=contact_id\n\nCombined:  \n[https://developer.salesfusion.com/api/2.0/contacts/?ordering=-contact_id](https://developer.salesfusion.com/api/2.0/contacts/?ordering=-contact_id)\n\nOperator = Sorts Ascending  \nOperator =- Sorts Descending\n\n#### API Throttle Rates\n\nThe REST API throttle rates are 90 calls per minute or 2000 calls per day, whichever happens first.\n\n#### Available Functionality\n\nAt current, the API supports CRUD operations for core CRM entities and a suite of core marketing automation functions.\n\n#### How to Get Help\n\nFor technical support, please contact us at the following: [support@sugarcrm.com](https://mailto:support@sugarcrm.com)\n\nPlease include a detailed description of what you are trying to accomplish and a code snippet or request and response objects if possible.","schema":"https://schema.getpostman.com/json/collection/v2.0.0/collection.json","isPublicCollection":true,"owner":"16759889","team":1034843,"collectionId":"cd74d81b-aacf-43e9-93d6-24d805e85dd3","publishedId":"2s83zjt3js","public":true,"publicUrl":"https://market.apidocs.sugarcrm.com","privateUrl":"https://go.postman.co/documentation/16759889-cd74d81b-aacf-43e9-93d6-24d805e85dd3","customColor":{"top-bar":"FFFFFF","right-sidebar":"303030","highlight":"EF5B25"},"documentationLayout":"classic-double-column","customisation":null,"version":"8.10.1","publishDate":"2022-10-24T19:43:25.000Z","activeVersionTag":"latest","documentationTheme":"light","metaTags":{},"logos":{}},"statusCode":200},"environments":[],"user":{"authenticated":false,"permissions":{"publish":false}},"run":{"button":{"js":"https://run.pstmn.io/button.js","css":"https://run.pstmn.io/button.css"}},"web":"https://www.getpostman.com/","team":{"logo":"https://res.cloudinary.com/postman/image/upload/t_team_logo_pubdoc/v1/team/12cb1075be7c22fc47030052f4ae79c7d95f9286eead86c5a903c7b6ac648efc","favicon":"https://postman-image-service.postman.com/api/cloudinary-proxy/postman/image/upload/v1776433026/team/1e4cbe57bb1bafd90f5439947004a1f3"},"isEnvFetchError":false,"languages":"[{\"key\":\"csharp\",\"label\":\"C#\",\"variant\":\"HttpClient\"},{\"key\":\"csharp\",\"label\":\"C#\",\"variant\":\"RestSharp\"},{\"key\":\"curl\",\"label\":\"cURL\",\"variant\":\"cURL\"},{\"key\":\"dart\",\"label\":\"Dart\",\"variant\":\"http\"},{\"key\":\"go\",\"label\":\"Go\",\"variant\":\"Native\"},{\"key\":\"http\",\"label\":\"HTTP\",\"variant\":\"HTTP\"},{\"key\":\"java\",\"label\":\"Java\",\"variant\":\"OkHttp\"},{\"key\":\"java\",\"label\":\"Java\",\"variant\":\"Unirest\"},{\"key\":\"javascript\",\"label\":\"JavaScript\",\"variant\":\"Fetch\"},{\"key\":\"javascript\",\"label\":\"JavaScript\",\"variant\":\"jQuery\"},{\"key\":\"javascript\",\"label\":\"JavaScript\",\"variant\":\"XHR\"},{\"key\":\"c\",\"label\":\"C\",\"variant\":\"libcurl\"},{\"key\":\"nodejs\",\"label\":\"NodeJs\",\"variant\":\"Axios\"},{\"key\":\"nodejs\",\"label\":\"NodeJs\",\"variant\":\"Native\"},{\"key\":\"nodejs\",\"label\":\"NodeJs\",\"variant\":\"Request\"},{\"key\":\"nodejs\",\"label\":\"NodeJs\",\"variant\":\"Unirest\"},{\"key\":\"objective-c\",\"label\":\"Objective-C\",\"variant\":\"NSURLSession\"},{\"key\":\"ocaml\",\"label\":\"OCaml\",\"variant\":\"Cohttp\"},{\"key\":\"php\",\"label\":\"PHP\",\"variant\":\"cURL\"},{\"key\":\"php\",\"label\":\"PHP\",\"variant\":\"Guzzle\"},{\"key\":\"php\",\"label\":\"PHP\",\"variant\":\"HTTP_Request2\"},{\"key\":\"php\",\"label\":\"PHP\",\"variant\":\"pecl_http\"},{\"key\":\"powershell\",\"label\":\"PowerShell\",\"variant\":\"RestMethod\"},{\"key\":\"python\",\"label\":\"Python\",\"variant\":\"http.client\"},{\"key\":\"python\",\"label\":\"Python\",\"variant\":\"Requests\"},{\"key\":\"r\",\"label\":\"R\",\"variant\":\"httr\"},{\"key\":\"r\",\"label\":\"R\",\"variant\":\"RCurl\"},{\"key\":\"ruby\",\"label\":\"Ruby\",\"variant\":\"Net::HTTP\"},{\"key\":\"shell\",\"label\":\"Shell\",\"variant\":\"Httpie\"},{\"key\":\"shell\",\"label\":\"Shell\",\"variant\":\"wget\"},{\"key\":\"swift\",\"label\":\"Swift\",\"variant\":\"URLSession\"}]","languageSettings":[{"key":"csharp","label":"C#","variant":"HttpClient"},{"key":"csharp","label":"C#","variant":"RestSharp"},{"key":"curl","label":"cURL","variant":"cURL"},{"key":"dart","label":"Dart","variant":"http"},{"key":"go","label":"Go","variant":"Native"},{"key":"http","label":"HTTP","variant":"HTTP"},{"key":"java","label":"Java","variant":"OkHttp"},{"key":"java","label":"Java","variant":"Unirest"},{"key":"javascript","label":"JavaScript","variant":"Fetch"},{"key":"javascript","label":"JavaScript","variant":"jQuery"},{"key":"javascript","label":"JavaScript","variant":"XHR"},{"key":"c","label":"C","variant":"libcurl"},{"key":"nodejs","label":"NodeJs","variant":"Axios"},{"key":"nodejs","label":"NodeJs","variant":"Native"},{"key":"nodejs","label":"NodeJs","variant":"Request"},{"key":"nodejs","label":"NodeJs","variant":"Unirest"},{"key":"objective-c","label":"Objective-C","variant":"NSURLSession"},{"key":"ocaml","label":"OCaml","variant":"Cohttp"},{"key":"php","label":"PHP","variant":"cURL"},{"key":"php","label":"PHP","variant":"Guzzle"},{"key":"php","label":"PHP","variant":"HTTP_Request2"},{"key":"php","label":"PHP","variant":"pecl_http"},{"key":"powershell","label":"PowerShell","variant":"RestMethod"},{"key":"python","label":"Python","variant":"http.client"},{"key":"python","label":"Python","variant":"Requests"},{"key":"r","label":"R","variant":"httr"},{"key":"r","label":"R","variant":"RCurl"},{"key":"ruby","label":"Ruby","variant":"Net::HTTP"},{"key":"shell","label":"Shell","variant":"Httpie"},{"key":"shell","label":"Shell","variant":"wget"},{"key":"swift","label":"Swift","variant":"URLSession"}],"languageOptions":[{"label":"C# - HttpClient","value":"csharp - HttpClient - C#"},{"label":"C# - RestSharp","value":"csharp - RestSharp - C#"},{"label":"cURL - cURL","value":"curl - cURL - cURL"},{"label":"Dart - http","value":"dart - http - Dart"},{"label":"Go - Native","value":"go - Native - Go"},{"label":"HTTP - HTTP","value":"http - HTTP - HTTP"},{"label":"Java - OkHttp","value":"java - OkHttp - Java"},{"label":"Java - Unirest","value":"java - Unirest - Java"},{"label":"JavaScript - Fetch","value":"javascript - Fetch - JavaScript"},{"label":"JavaScript - jQuery","value":"javascript - jQuery - JavaScript"},{"label":"JavaScript - XHR","value":"javascript - XHR - JavaScript"},{"label":"C - libcurl","value":"c - libcurl - C"},{"label":"NodeJs - Axios","value":"nodejs - Axios - NodeJs"},{"label":"NodeJs - Native","value":"nodejs - Native - NodeJs"},{"label":"NodeJs - Request","value":"nodejs - Request - NodeJs"},{"label":"NodeJs - Unirest","value":"nodejs - Unirest - NodeJs"},{"label":"Objective-C - NSURLSession","value":"objective-c - NSURLSession - Objective-C"},{"label":"OCaml - Cohttp","value":"ocaml - Cohttp - OCaml"},{"label":"PHP - cURL","value":"php - cURL - PHP"},{"label":"PHP - Guzzle","value":"php - Guzzle - PHP"},{"label":"PHP - HTTP_Request2","value":"php - HTTP_Request2 - PHP"},{"label":"PHP - pecl_http","value":"php - pecl_http - PHP"},{"label":"PowerShell - RestMethod","value":"powershell - RestMethod - PowerShell"},{"label":"Python - http.client","value":"python - http.client - Python"},{"label":"Python - Requests","value":"python - Requests - Python"},{"label":"R - httr","value":"r - httr - R"},{"label":"R - RCurl","value":"r - RCurl - R"},{"label":"Ruby - Net::HTTP","value":"ruby - Net::HTTP - Ruby"},{"label":"Shell - Httpie","value":"shell - Httpie - Shell"},{"label":"Shell - wget","value":"shell - wget - Shell"},{"label":"Swift - URLSession","value":"swift - URLSession - Swift"}],"layoutOptions":[{"value":"classic-single-column","label":"Single Column"},{"value":"classic-double-column","label":"Double Column"}],"versionOptions":[],"environmentOptions":[{"value":"0","label":"No Environment"}],"canonicalUrl":"https://market.apidocs.sugarcrm.com/view/metadata/2s83zjt3js"}