I use DHC by Reslet a Chrome extension, version 1.2.
When I create a first POST request to create an entity
If I want to access to this request in a another request (repository feature) I cannot access the response.
I have the same problem with DELETE requests, but not for GET requests
I'm not sure to correctly understand what you want to do but I'll try to give you an answer.
Imagine I want to execute the following:
POST request to add a company using the URL /companies and get its identifier from the response
GET request to get the newly created company using the identifier from the previous request
To do that I need to save the first request. I save it with the name 1 - Add company under the project Company project and the service CRUD service:
Company project
CRUD service
1 - Add company
Here is what I can use within the second request within its URL field:
contactsapi.apispark.net/v1/companies/{"Company project"
."CRUD scenario"."1 - Add company".response.body.id}
This way DHC will use the value of the id field in the response body from the latest executed 1 - Add company request in the history.
Related
The aim is to connect to a public REST api using ADF. It's my first stab at sending requests to a REST api in ADF. It is the Companies House ('CH') governement website's API in England.
I have created an account and obtained a key. Apparently, it is basic authentication and the user name is the API key and password will be ignored (CH note on authentication)
I want to explore the contents of the 'Search all' API (CH note on Search All) and want to copy the results to Blob Storage.
I therefore set the linked service to use REST as below, the obfuscated User Name is the key I obtained from CH, the password is jsut the key repeated as their documentation states they ignore the password:
[
I then have added a REST dataset referencing this linked service:
And the testing of the connection works fine.
Problems then arise in the copy data task, I am getting an error when previewing and also when I attempt a copy to blob of 'Invalid Authorization Header':
I'd be grateful for pointers on where I'm going wrong.
I can't reproduce your Auth error but i notice that you want to add some parameters with your GET request in the Request Body.
I think you need to add parameters in relativeUrl property:
A relative URL to the resource that contains the data. When this
property isn't specified, only the URL that's specified in the linked
service definition is used. The HTTP connector copies data from the
combined URL: [URL specified in linked service]/[relative URL
specified in dataset].
Also i suggest you checking the correct REST API format of Search Api you are using.There is no other special features in the ADF REST connector. Just make sure the GET request works locally and duplicate it.
I got my Magento2 installed. Admin site is easy accessed on:
http://devstore.panstore.eu/magento2/web/adminedit/admin
If I try:
http://devstore.panstore.eu/magento2/web/rest/products
I get:
Specified request cannot be processed.
If I try:
http://devstore.panstore.eu/magento2/web/rest/oauth_authorize?auth_consumer_key=consumer_key&oauth_consumer_secret=consumer_secret
I get same response: specified request cannot be processed.
I think my base URL is wrong.
What is base URL in my example?
How to authorize to be able to call list of products service.
Unfortunately, Magento documentation is totally useless for quick startup.
There are no any functional postman collection, no easy step by step guides to jump in. I didn't find the solution on NET.
After very long studying, result is here and is real time saver.
In my particular case, base url is: http://devstore.panstore.eu/magento2/web
Token for authentication you simply get with this URL:
your_token = http://base_url/rest/V1/integration/admin/token?username=your_user&password=your_pass
your_user and your_pass are defined in Magento admin users, add also appropriate roles.
After you receive token, add this header to GET request:
Authorization: Bearer your_token
and simply call Magento 2 services by REST path (this one gets one product with SKU = 24-MB01):
http://base_url/rest/default/V1/products/24-MB01
Assume we have an api - /student/getStudentDetails/{id} which returns a JSON response containing the succeeding internal rest api (/student/getAdvancedStudentDetails/{id}).
{
id:123,
name:Alex,
nextapi:/student/getAdvancedStudentDetails/123
}
Here when we get the response from first api - /student/getStudentDetails, we need to process the JSON response and take out the second api from the first api and call it.
Any suggestions?
Your first response for first api "GET student details" only returns high level details of student and one of field "nextapi" in response has URL to GET more details about student.
In Your first response "nextapi" is customer field defined by you and it only has
URL without host and port details of sever. So Consumer of api, will have to parse First response. Create full http url and call the next api to get further details of student. It will not happen automatically.
eg http://localhost:8080/student/getAdvancedStudentDetails/123
{
id:123,
name:Alex,
nextapi:/student/getAdvancedStudentDetails/123
}
Note :
If your response had full http url for get advance details of student and if api was not secure api. Then if you view first Json, it might give you link for next api, which you can click and see advance details. You can give it try.
I'm designing a new REST API endpoints and have a doubts about API urls.
For example I have a Product entity and corresponding /products API.
In order to GET a specific product, everything is clear - I have to use something similar to:
GET /products/{productId}
in order to create a new one everything is clear too:
POST /products with a product details in the HTTP request body
but how to deal with product update ?
There is two options which I can see right now:
PUT /products/{productId} with a new product details in the HTTP request body
or
PUT /products with a {productId} and new product details in the HTTP request body
the same question for product delete.
What is the best practice here in order to send {productId} to server ?
You should use PUT /products/{id} to update the product.
In the Body you should send the ressource or the changes.
The PUT method requests that the enclosed entity be stored under the
supplied Request-URI. If the Request-URI refers to an already existing
resource, the enclosed entity SHOULD be considered as a modified
version of the one residing on the origin server.
Reference HTTP-Methods
A testcase contains 2 requests and 1 groovy script.
Now 1st request is using POST method and 2nd request is using GET method.
Now I am facing an issue that If I am changing the 2nd request as GET, my 1st request also gets turned into GET request while I need 1ST Request to remain as POST.
How to handle this situation?
I am new in Soap UI. any suggestion will be helpful.
You can create multiple methods under the same endpoint - this is what REST is designed to do!
Under your "Api" resource, right-click, and select "New Method". Select this new one to be of type GET. This is going to be your "CheckingResponse". So the final hierarchy for your endpoint will look like:
REST Project 1
+-[REST] http://endpoint.URL/...
+-Api [] <--- THIS IS A RESOURCE
+-[POST] Api <--- THIS IS YOUR CURRENT METHOD
| +-3LevelProducts
+-[GET] Api <--- THIS IS A NEW METHOD
+-CheckingResponse
Refer my answer here:-
http://stackoverflow.com/questions/34786729/if-a-request-is-changed-to-post-then-soapui-changing-all-other-requests-into-po/34831359#34831359
there I have described a full example to achieve the issue