Any tool that allows you to make REST API calls, such as cURL or Postman. The article provides cURL examples.
10 minutes of spare time.
Getting an access token
The GroupDocs.Rewriter Cloud API is fully compliant with industry security standards and best practices. Data transfer is carried out using JWT authentication, which eliminates all possibilities of data theft or disclosure.
To obtain a JWT token, get the Client ID and Client Secret credentials:
Create the samples storage for exchanging files by clicking the plus icon and following the required steps. Internal storage with 24-hour retention will suffice.
Provide the application name, for example, HelloWorld.
Click Save button.
Click the newly created HelloWorld application and copy the values from Client Id and Client Secret fields.
Now request an access token with the following API call:
The access token will be valid for the number of seconds specified in the expires_in property. If it has expired, request a new one using the same credentials.
Sending text for rephrasing
Let’s rephrase the following simple text:
Hello, everyone! We will try to rephrase this text into something new.
The rephrasing is carried out in 2 stages. First we need to POST a request to the GroupDocs.Rewriter Cloud API with parameters in JSON format in the body:
curl --request POST --location 'https://api.groupdocs.cloud/v2.0/rewriter/paraphrase/text'\
--header 'Content-Type: application/json'\
--header 'Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9...LxLejtsVFwrZpHA'\
--data '{
"language": "en",
"text": "Hello, everyone! We will try to rephrase this text into something new.",
"suggestions": "One",
"diversityDegree": "Medium"
}'
The authorization header must contain the access token obtained earlier.
Wait a moment. The request will be placed in the queue and you will get its unique identifier. For example:
The text processing will take a second or two, depending on the length of the text and the current GroupDocs.Rewriter Cloud load. After the rephrasing is completed, the paraphrased text can be obtained by sending the unique identifier of the request obtained on the previous step to https://api.groupdocs.cloud/v2.0/rewriter/paraphrase/text/ endpoint:
The authorization header must contain the access token obtained earlier.
You will get the following response:
{"paraphraseReult":"Hello, everyone! We are going to try to recast this text as something new.","paraphraseResults":null,"sourceList":null,"targetList":null,"statusCode":200,"message":"Text processed successfully"}
You can fetch the paraphrased texts from the paraphraseResult property.
What’s next?
Congratulations! You have successfully paraphrased the text using GroupDocs.Rewriter Cloud API.
Read the Developer’s Guide and API Reference for details on creating advanced content processing solutions with GroupDocs.Rewriter Cloud.
Was this page helpful?
Any additional feedback you'd like to share with us?
Please tell us how we can improve this page.
Thank you for your feedback!
We value your opinion. Your feedback will help us improve our documentation.