![]() The key to using Postman with NetSuite is to provide pre-request JavaScript code, run prior to invoking an operation. Postman's documentation discusses OAuth1.0, but it doesn't describe the technique necessary to authenticate with the NetSuite API. This post uses Postman - a cross-platform application that can be used to issue SOAP requests using OAuth1.0 for authentication. Many tools are available for interactively creating, sending, and analyzing SOAP requests. The SOAP Schema Browser is used in conjunction with the SuiteTalk (Web Services) Records Guide available via help within your account.Īdditional information can be found by searching help for NetSuite WSDL and XSD Structure. ![]() These resources fully describe this version used in this post: If you use a different version, it may be necessary to modify the XML in these examples to match your API version. In this post, we will use the 2017_1 version. The API is versioned, with each version being specified by a WSDL file. If this isn't the case, refer to the Getting Started section of the SuiteTalk Platform Guide.Ī summary of all the necessary steps can be found in our NetSuite Setup Instructions blog post. Let me know if you run into any issues, just leave a comment below.The examples in this post assume that a SOAP integration record is already setup in your account. Variables allow you to store and use them for subsequent calls which removes a lot of manual steps. Then select the existing collection, and click on Save to Anypoint Platform.Īs you can see, setting up Postman with a Workspace will make you more productive. Click on Save and give the request a name (e.g. Lastly, let’s save this call to the Collection we previously setup. Postman stores the token from the previous call and allows you to reference that variable in subsequent calls. The will leverage the token that was generated in the setup. Click on the Headers tab and enter the following key/value pairs: Make sure you are still in the MuleSoft workspace. For this example, just paste the following API and leave the dropdown as a GET request: Click on the ‘+’ sign to add a new request. This next section walks you through the quick process of leveraging the access_token variable. Give your collection a name and click on the checkmark. Login) and then click on + Create Collection. Normally you’d see the invalid csrf token error but the script removes the cookie automatically and allows you to make repeated calls to generate a new access_token. Let's test the API call twice by clicking Send. It also stores the access_token into the variable so you can pass that in the header to subsequent calls as well. ![]() The script clears the Cookies, specifically the _csrf cookie, so you can make repeated calls without having to manually clear it every time. These correspond to the variables you setup in the workspace.Ĭlick on the Tests tab and copy and paste the following script: Next, click on the Body tab and check the x-www-form-urlencoded radio button. On the far right of the screen, click on Cookies.Ĭlick on Whitelist Domains on the bottom left.Įnter in *. and click on Add. This will allow the script you add later to make changes to the cookies. MuleSoft)įor the Initial Value column, enter your username and password for the Anypoint Platform.Ĭreate a new request by pasting the following into the Enter request URL field: and then change the drop-down to POST. Logins, passwords, access tokens, etc…Ĭlick on the gear icon in the top right and then click on Add ![]() Setting up a workspace in Postman allows you to store variables that can be propagated to subsequent API calls. This article assumes you have an Anypoint Platform account and Postman (7.12.0) installed on your machine. By following the steps and setting up Postman, you’ll save yourself a lot of time by removing some manual steps. You may also like: API Lifecycle in Anypoint PlatformĪn example of an issue that this article resolves is the “ login” request where you run into the “ invalid csrf token” issue. Out-of-the-box, you can use Postman to call the Anypoint Platform APIs but there are some tips and tricks in this article to help make it easier. It provides an intuitive interface that’s easy to use and allows developers an easy way to configure, interact, and test APIs. Postman has pretty much become the de facto standard for any developer that works with APIs. Learn more about Postman for MuleSoft Anypoint Platform APIs.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |